Armin Ronacher

Bush in Austria

written by Armin Ronacher, on Saturday, June 24, 2006 0:00.

Three days ago George W. Bush visited Austria. Beside the fact that there was a demonstration called stopbush with between 15.000 and 20.000 visitors, which I really found good since I can't stand the politic orientation of the current American president, our government did something really stupid!

When I read about that demonstration in nico's blog I was quite happy about that event. Since the war against Afghanistan I was really unhappy about the American president and his decisions. I was even happier when I read in the same blog about the success of the demonstration (more than 15.000 people participated)

But two hours ago I had to regonice that the Austrian government is exactly the same. Because of the high security level they contacted all doctors and other medical facilities on the route of the American president to get informations about their patients. The same applied for many companies if I can trust heise.

Why the hell can our government can afford that normal working in a city isn't possible just because one f***ing person wants to visit Austria and talk to our president/Kanzler/<insert other person here involved into political decisions>? Many people were upset about the effords and costs caused by the visit of the president in Vienna. Many streets were blocked and the inner city was locked up.

Normally I like living in Austria. But now I feel abashed of our government doing everything what a person from an other country does just because he's the presitent of the united states. And I can live with that if they would protect personal rights.

And now I continue reading.

wsgi.org online

written by Armin Ronacher, on Sunday, June 18, 2006 0:00.

Nice :-) The new wsgi.org wiki is online. Check it out.

Some minutes ago I read ian bicking's blog where he mentiones that "Stephen Diehl set up wsgi.org as a central location for WSGI-related content."

That's very good since we now have a central wiki where it's possible to collect all available information about WSGI. I hope this will advertise WSGI better - it looks like many people still use CGI/mod_python directly without an WSGI gateway.

btw: I've set up a wiki too for collecting some links and other stuff that look use useful for me

NDS Devs - where are you?

written by Armin Ronacher, on Saturday, June 17, 2006 0:00.

Since I own a nintendo DS I'm really interrested in developing applications for this platform. But where is the community?

Yesterday I finally managed it to run a Hello World script inside of an emulated DS system. That's not that easy. Why? Because wifime which is the only way atm to send software via wireless lan to the Nintendo DS is closed source, requires windows and a RT2500/RT2560 chipset wireless device.

And I don't own a legal windows version, don't want to buy and install one for my notebook, don't want to buy a RT2500/RT2560 chipset wireless device nor do I want to develop using closed source programs/drivers/libs.

Additionally I never had worked with an ARM processor before, and never had developed something with two of them. (And never did something bigger using C as programming language).

The first thing was easy to manage: finding a lib and a compiler for the ds. I found a good page with a quickstart here: double.co.nz/nintendo_ds. But Finding an emulator wasn't that easy. It looks like I'm either too stupid to find linux emulators or the current versions of existing emulators don't support linux. But there was light :) On the German emulator page aep-emu I found a list of emulators. Two of them claim that they support linux. There's nothing mentioned on the webpage but the download link for Desmue on thst page works. And if you have a look in the repository you can find linux sources there too. So an emulator isn't the problem.

After I trued out the ndslib I had to notice that the documentation is nearly useless. There is no tutorial beside the one linked above.

But there is something called palib which looks better. But I havn't tested it by now.

I don't understand that there is something called dslinux, but you need a windows pc to be able to upload games via wifi. All project I've seen use make and other gnu tools but shit a built.bat which looks like this:

make
pause

strange. Isn't there a linux ds developer community?

Hungarian Notation

written by Armin Ronacher, on Wednesday, June 14, 2006 0:00.

Today there was a funny discussion on #moin-dev about Hungarian notation. I think it's great fun to read - so here is the chatlog.

<Kepplar hi
<Kepplar yea
<Kepplar meta data on the flat file storage engine and attachments should be in within the next few days
<Kepplar but
<Kepplar thats without any intergration into the moin engine
<Kepplar ThomasWaldmann: i may be out for a few days while i move to Cambridge, just giving you a heads up
<Kepplar with the metadata problem which have two choice
<Kepplar a) go with the current format
<Kepplar or b) refactor to include alterations to the directory
<Kepplar this will make this system incompatble with previous versions
<Kepplar personally i prefer the idea of going with a flatfile module and a compatbility mode which just inherits and overrides the metadata stuff as usual
<Kepplar but might be problematic as how i've done data is literally just pull the content of the file out
<ThomasWaldmann what's the problem with something similar to MetaDict ?
<Kepplar the main issue with the cambridge delay is they've now installed frigging wireless and i dont have a pci card or a laptop with duel
<Kepplar metadict?
<ThomasWaldmann alzheimer?
<Kepplar ?
<ThomasWaldmann I already pointed you to wikiutil.MetaDict 1-2 weeks ago
<Kepplar probably, but since theres no real documentation i probably forgot :)2A
<richardb Kepplar: moving to Cambridge, UK?  I'm very near there (9 miles).  What are you going to be up to there?
<Kepplar hmm?
<mitsuhiko Kepplar: man epydoc
<mitsuhiko the moin sourcecode contains of many docstrings
<Kepplar lets just say, best not for me to comment on my opinion of some docstrings ive seen :)
<xorAxAx mitsuhiko: isnt it nice? click me
<xorAxAx mitsuhiko: vb-compatible storage abstraction :)
<mitsuhiko omg
<mvirkkil Kepplar: I understand you'll lay some groundwork for supporting metadata?
<Kepplar xorAxAx: vb compatible?
<mitsuhiko it's Hungarian notation
<Kepplar xorAxAx: my code is far from finished :P
<mitsuhiko xorAxAx: and smallCase for classnames
<mitsuhiko each module it's own styleguide. that's moin :)
<Kepplar if people have a point, make it :P
<xorAxAx mitsuhiko: its modern art you philistine!
<mitsuhiko  84 def fs_rev_to_int_rev(self, str_revision):
<mitsuhiko 85 """Converts file system revision notation to integer.
<mitsuhiko 86
<mitsuhiko 87 @param str_revision: File system revision notation.
<mitsuhiko 88 @return int_revision
<mitsuhiko 89 """
<mitsuhiko 90 return int(str_revision)
<Kepplar yes
<xorAxAx Kepplar: we had it already a few times before
<ThomasWaldmann Kepplar: getting a wlan card shouldnt delay you much. you can get such stuff at every corner...
<mitsuhiko yeah. it's a int() clone
<mitsuhiko (or alias?)
<Kepplar no
<Kepplar that is completly valid
<Kepplar The function that is called describes an action. That action may or may not change in the future, it should not be tight-ly coupled with the actual operation
<Kepplar should the mechanism alter, instead of replacing it all over the place, you replace it once
<xorAxAx Kepplar: the fs rev should never leak the proxy
<Kepplar Basic software design
<Kepplar leak?
<xorAxAx Kepplar: so such a method should not be public
<mitsuhiko Kepplar: use just one id
<xorAxAx Kepplar: leak! no other object should know it
<Kepplar agreed
<mitsuhiko there shouldn't be a public internal id
<Kepplar it is private
<Kepplar i havent _ed it yet
<ThomasWaldmann Kepplar will have to rename all those functions and attribute names before it gets into main. fun :)
<mitsuhiko .oO(where's the leading underline?)
<xorAxAx Kepplar: just make a comment but not an underscore
<Kepplar There isnt because its work in progress
<xorAxAx Kepplar: in the docstring
<mitsuhiko xorAxAx: erm. why not an underline?
<Kepplar ThomasWaldmann: whats wrong with the function name?
<xorAxAx mitsuhiko: because i dislike that :)
<mitsuhiko hehe
ThomasWaldmann is talking of <type>_<name> type names
<xorAxAx ok, it would be ok
<mvirkkil Kepplar: Is it generic enough so that one may embed annotations like lets say we have an article about Einstein and at some point his dad Hermann would be mentioned. Now I want to annotate that Hermann-fatherOf-Albert.
<Kepplar ?
<Kepplar mvirkkil: what are you talking about?
<mvirkkil Kepplar: The metadata stuff you are laying the groundwork for.
<Kepplar ThomasWaldmann: I've failed to meet anyone outside this room who endorses you're approach to naming convensions
<Kepplar your*
<xorAxAx mvirkkil: sounds like RDF
<Kepplar mvirkkil: i just store the metadata, i don't care how it's used, the storage engine isnt intelligent like that
<ThomasWaldmann NOONE code python like you do, believe me.
<mitsuhiko Kepplar: i don't get it. you're a soc student?
<xorAxAx LOL
<Kepplar mitsuhiko: yes
<mvirkkil xorAxAx: (it is. I'm working at my universitys semantic web research lab)
<mitsuhiko Kepplar: so do what your mentor tells you
<xorAxAx mvirkkil: it mainly means storing 2-tuples per page
<Kepplar ThomasWaldmann: sure, everyone has different naming convensions, but all have an indicator on type
<xorAxAx mvirkkil: which is trivial :)
<mitsuhiko and i don't think ThomasWaldmann likes Hungarian notation
<mvirkkil xorAxAx: What is trivial? Storing key value pairs about the wikipage?
<Kepplar mitsuhiko: i do, but i refuse to write bad code
<mitsuhiko Kepplar: Hungarian notation IS bad code
<xorAxAx mvirkkil: yes
<xorAxAx mitsuhiko: except in VB
<mitsuhiko even the inventor of that bullshit isn't using it any more
<mvirkkil xorAxAx: Yup. That's why it's also not interesting to me :)
<mitsuhiko xorAxAx: option explicit
<mvirkkil xorAxAx: With the exception of putting some simple additional information in to docbook.
<Kepplar mitsuhiko: bad code, why? lol
<xorAxAx mitsuhiko: doesnt change it
<ThomasWaldmann all our soc students should keep in mind that half term report is not too far away
<mitsuhiko xorAxAx: ok. you're right. vb sucks ^^
<mitsuhiko scnr
<Kepplar agreed, vb is the spawn of the devil
<mitsuhiko then why do you use vb naming rules?
<ThomasWaldmann and there should be some substantial stuff visible for the mentor as a base for that report
<mitsuhiko ThomasWaldmann: do you know the famous paula been? ^^
<Kepplar you'd be out the door in UK industry if you tried to write code without types defined in the name, litterally no joke
<ThomasWaldmann or he won't have much to write in that report
<richardb Um.
<richardb Kepplar: not true.
<Kepplar richardb: where do you work?
<ThomasWaldmann mitsuhiko: from dailywtf?
<richardb Software consultant, cambridge, UK.
<mitsuhiko ThomasWaldmann: jup
<xorAxAx richardb is an unemployed stranger living under a bridge! just because he stopped using hungarian notation 30 years ago
<xorAxAx (i presume)
<xorAxAx thats life! :)
<richardb :)
<Kepplar code without it is simply unmaintainable
<mitsuhiko rofl
<Kepplar i have yet to hear a good reason against it
<mitsuhiko Kepplar: use google
<Kepplar richardb: what company/
<ThomasWaldmann and read thedailywtf.com about paula been(?) :))
<richardb My own consultancy, but clients include lots of IT firms.
<mitsuhiko Kepplar: http://www.kuro5hin.org/story/2002/4/12/153445/601
<mitsuhiko click me
<richardb My personal dislike of hungarian notation is that in well designed code it is unnecessary, and just slows development down.
<Kepplar i find it speeds it up
<Kepplar especially in distributed development environments
<Kepplar k5 article has a couple of good points i have to say
<richardb For example, in C, it should be obvious from the name of a function what type of thing it will accept, due to what the function does.
<richardb In python, though, functions should accept whatever type contains the information needed.
<Kepplar yes
<Kepplar i've taken that into account
birkenfeld (n=gbrandl@moinmoin/fan/birkenfeld) has joined #moin-dev
<richardb So, whilst I could just about imagine it being useful in some C projects (eg, where the design isn't clear enough, and can't be fixed)...
<Kepplar as i have said - if you want it removed, I will do it at the end, but not before
<richardb I can't see why it would ever be useful in python.
<richardb well, I'm not your mentor, or a core moin devel, but it sounds like you're going to have to do that. ;-)
<Kepplar richardb: however my protest will go into my report
<mitsuhiko rofl
<richardb Speaking of reports and things, has anyone seem fpletz over the last few days?
<mitsuhiko a student that ignores coding guidelines
<Kepplar theres guidelines?
<ThomasWaldmann yes, there are. they didn't include "dont use hungarian notation" yet, but we can add that.
<mitsuhiko Kepplar: http://moinmoin.wikiwikiweb.de/CodingStyle
<mitsuhiko it says "follows pep8"
<mitsuhiko and pep8 defines variable names
<Kepplar ah well, all python code should be pep8
__doc__ (n=doesnt@62-2-90-134.business.cablecom.ch) has joined #moin-dev
<__doc__ wer is hier der mit der ungarischen notation?
Gromit (n=bear@does-d9b91926.pool.mediaWays.net) has joined #moin-dev
<mitsuhiko lol
<__doc__ ^^
<mitsuhiko __doc__: en chan
<birkenfeld __doc__: in english
<mitsuhiko it's Kepplar
<__doc__ ah
<__doc__ Kepplar: you should be ashamed of yourself
Topic for #moin-dev is: MoinMoin Developer Channel - User or third-party issues should go to #moin. Note that you are publicly logged here: http://moinmoin.wikiwikiweb.de/MoinMoinChat/Logs/moin-dev
Topic for #moin-dev set by xorAxAx at Thu Dec 1 00:29:10 2005
<ThomasWaldmann Kepplar: duck! :)
<xorAxAx 16:49:53 -!- Irssi: New peak in #moin-dev@freenode : 16
<__doc__ Kepplar: I just looked at your source and I thought I go blind
<Kepplar ?
<Gromit means, __doc__ is not amused
<__doc__ oh I'm amused just fine
<Kepplar whats wrong with the code? (Except for being work in progress)
<Gromit oh
<Gromit do
<__doc__ did enough C++ olden days Borked things
mitsuhiko sets the topic to moinmoin comedy channel
<Gromit BTW: do you have a link to the code?
<__doc__ Kepplar: that's wrong str_location
<__doc__ click me
<Kepplar ?
<__doc__ Kepplar: what's str_ there?
<Kepplar its a string?
<__doc__ Kepplar: no, it's not a string, a string is str()
<xorAxAx str_ soudnds like an unnamed string
<Gromit urgs:    18    self.str_PAGEDIR = "pages"
<Gromit self?
<__doc__ Kepplar: it's a type prefix designator
<mitsuhiko __doc__: student tries running away
<mitsuhiko that's str
<Kepplar Gromit: yes?
<Kepplar ive lost you
<__doc__ Kepplar: so what if you decide you don't want location to be a string?
xorAxAx fetches some popcorn
<birkenfeld Kepplar: if you were consistent you'd have inst_self
Gromit takes another look
<mitsuhiko >>> class A(object):
<mitsuhiko ...  self.cant = 'work'
<mitsuhiko ...
<mitsuhiko Traceback (most recent call last):
<mitsuhiko   File "<stdin>", line 1, in ?
<mitsuhiko   File "<stdin>", line 2, in A
<mitsuhiko NameError: name 'self' is not defined
<Kepplar birkenfeld: inst_self?
<birkenfeld Kepplar: yes, self is an instance. to signify that you add "inst_"
<xorAxAx birkenfeld: ACK. def foo(inst_of_class_x_self, str_bar, int_baz): ...
<mitsuhiko rofl
<birkenfeld xorAxAx: no, def meth_foo
<xorAxAx birkenfeld: OOPS!
<birkenfeld or, def str_foo
<Kepplar mitsuhiko: *shrugs*
<Kepplar mitsuhiko: fair enough, i just need to move it, i can't remember everything without running it
<Kepplar at the moment I haven't tested the code
<mitsuhiko Kepplar: NO
<mitsuhiko 1.) drop those prefoixes
<mitsuhiko 2.) just remove the self. for constant assignment
<Gromit how about:  18 str_PAGEDIR = "pages"
<Gromit 19 str_USERDIR = "user"
<Gromit 20 ser_CURRENT_FILE = "current"
<__doc__ Kepplar: what's a list of strings for you, list_str_myvar?
<birkenfeld btw, what are temporary constants?
<Gromit i do that all the time
<Kepplar __doc__: just a list
<__doc__ Kepplar: and what about if you change the type, say you don't want location to be a string anymore?
<Kepplar its immutable
<Gromit birkenfeld: "constants aren't, variables won't" as murphy says
<mitsuhiko birkenfeld: constants assigned in instSelf
<Kepplar you'd be copying it anyway
<__doc__ Kepplar: you do prefixes everywhere
<mitsuhiko __doc__: hmm. a list of tuples of str and int...
<__doc__ Kepplar: how do you know what a function returns?
<Kepplar docs?
<birkenfeld doesn't get_data return a get?
<__doc__ Kepplar: c'mon be consistent, that must be called tuple_myfunction
<mitsuhiko rofl
do3cc (n=patger@217.79.183.40) has joined #moin-dev
<Kepplar lol
<xorAxAx today's lesson: every bigger open source program has a community that joins the team in important situations, even if they are not contributing to the matter
<__doc__ ^^
<mitsuhiko __doc__: str_int_tupleMyFunction please
__doc__ knows why he's not goint to look at moinmoin, ever
<__doc__ mitsuhiko: right, but then how do you know structure
<Kepplar fair point with the get_ return, however im following pep8 when it comes to function naming convension
<__doc__ mitsuhiko: you need a braces identifier
<mitsuhiko hmm
<__doc__ mitsuhiko: let's take x for opening brace and X for closing
<mitsuhiko yeah. that's good
<mitsuhiko and c for comma
<__doc__ mitsuhiko: tuple_x_int_str_X_myfun()
<__doc__ mitsuhiko: good!
<mitsuhiko def meth_tuple_x_int_c_str_X(inst_self):
<__doc__ mitsuhiko: tuplexintcstrXmyfun()
<__doc__ mitsuhiko: what kind of inst is that?
<mitsuhiko yeah
<mitsuhiko def meth_tuple_x_int_c_str_X(inst_MyClass_self):
<mitsuhiko __doc__: care of metaclasses!!!
<__doc__ mitsuhiko: but derive that MyClass from a new style or not?
<mitsuhiko def meth_tuple_x_int_c_str_X(inst_MyClass_of_type_self):
<__doc__ yeah!
<ThomasWaldmann maybe we could make a channel #chan_hungariannotationhaters for that
birkenfeld thinks of writing an obfuscator using hungarian notation
<__doc__ Kepplar: you with us?
<__doc__ mitsuhiko: ohwait, how do you know that's a function and not a method?
<__doc__ ah, meth right?
<mitsuhiko __doc__: hmm. and the module name?
<__doc__ mitsuhiko: what if it also is decorated with a property?
<mitsuhiko __doc__: we don't need properties. man get_str/set_str
<Gromit birkenfeld: jup, PyPy's anotator would help there
<__doc__ myproperty_meth_tuple_x_int_c_str_X (inst_MyClass_derives_OtherClass_which_is_new_style_type)
<birkenfeld __doc__: I think the next step would be to remove the function name since the prefix is unique without it
<__doc__ birkenfeld: good point!
<birkenfeld and it gets shorter then
<__doc__ birkenfeld: and we could shortify it by taking the first two letters of every _ seperated prefix in camel case
<Gromit whioch would read: myproperty_meth_tuple_x_int_c_str_X (inst_MyClass_derives_OtherClass_which_is_new_style_type_with_name_removed?
<birkenfeld Gromit: yes, just like this
<__doc__ MyMeXIntCStrX(InDeOtWhIsNeStTy)
<birkenfeld __doc__: hey, that reminds me of Windows API
<__doc__ right
<__doc__ wonderfull isn't it
<mitsuhiko hmm
<do3cc Thats unreadable, you should write metapython code and run it through a parser, which makes python out of it
<Gromit did we now make enough fun of Kepplar's coding style?
<Kepplar Ok lets just get a few things straight. a) i dont care about getting involved with elitist pythonic community squabbles, i produce instustry standard code. Should it need refactoring at the end to fit you're designs, then thats your choice but for productivity sake I would like to continue with my code. Furthermore you have your opinions - which is fine by me. I disagree, and to be honest, I find the general moin code so badly documented its serious
<birkenfeld it's even wonderful
<__doc__ Kepplar: c'mon let's join, startup your svn and make some *sensible* prefixes there!
<mitsuhiko __doc__: and what if a function takes str and unicode?
<birkenfeld "Hungarian Python"?
<__doc__ "i produce instustry standard code" muaaaaahahahahahroflbtc
birkenfeld now really rolls on floor
<birkenfeld LOOOOOOOOOOOOOL
indro (n=indro@80-218-247-93.dclient.hispeed.ch) has joined #moin-dev
<__doc__ mitsuhiko: hard hard
<Kepplar __doc__: you obviously never worked in industry
<mitsuhiko best comedy ever
<mitsuhiko ROFL
<__doc__ Kepplar: I'm a successfull programmer for the last 7 years
<__doc__ Kepplar: be my guest
<birkenfeld .oO( how did Python ever get used in industry without using hungarian notation? )
<Kepplar "successful" ok
<__doc__ Kepplar: type elitist, much better then no-nonsense elitist eh?
<Gromit Kepplar: jus a question, to understand you better:
ChrisLong (i=someone@dslb-082-083-131-204.pools.arcor-ip.net) has joined #moin-dev
<Gromit From whcih country are you?
<Kepplar UK
<mitsuhiko __doc__: .oO(is hungarian notation web2.0?)
<__doc__ mitsuhiko: yeah!
<mitsuhiko i really like to publish that log on lucumr
<birkenfeld Kepplar: "I don't care" is not appropriate when coding within a community
<Gromit IC, thanks?
<xorAxAx Gromit: not from ungaria :)
<xorAxAx h
<Kepplar birkenfeld: i don't care about the squabbling
<Kepplar not the working together
<Kepplar as soon as it gets elitist
<xorAxAx mitsuhiko: link the wiki page tonight
<mitsuhiko lol
<Kepplar i only hear "meemmemememememem"
<mitsuhiko xorAxAx: I'll do
<birkenfeld Kepplar: define "elitist"
<mitsuhiko xorAxAx: or i will extract the most important part. don't want do diggeffect wikiweb.de :)
<__doc__ Kepplar: could you please write an interpreter that translates your code to human readable semantic form?
<Kepplar __doc__: are you unable to see str as a string?
<mitsuhiko __doc__: ThomasWaldmann is so quiet. i'm sure he's writing that interpreter atm
<mitsuhiko str == bytes
<__doc__ Kepplar: well you know usually I prefer to read names at face value
<Kepplar __doc__: imho, moin's code is generally hard to read
<mitsuhiko unicode == string
<ThomasWaldmann no, I am doing some work in parallel :)
<__doc__ Kepplar: ahum, since it's hard to read on general you don't want to stick out right?
<__doc__ Kepplar: and specially I hate to run a redefine everything session when the type of something changes
<mitsuhiko __doc__: bycicle repair man
<ThomasWaldmann Maybe we can just agree on that Kepplar's deadline will be one week early because he will need that long to refactor and test everything.
<Kepplar refactor on your IDE2?
<Kepplar -2
<__doc__ Kepplar: what's a itrv, quick!
<__doc__ 1
<__doc__ 2
<__doc__ 3
<__doc__  lost
<Kepplar ThomasWaldmann: i have a weeks contingency i think you find =)
<mitsuhiko lol
<Kepplar item revision
<xorAxAx lol
<Kepplar this will be documented
<do3cc Kepplar: what editor are you using?
<__doc__ Kepplar: o-ho, "this will be documented" when?
<mitsuhiko do3cc: hmm. visual studio i guess
<Kepplar im using eric, but ill move to eclipse as soon as that plugin is released
<mitsuhiko aah
<xorAxAx Kepplar: hmm, it already works with python, doesnt it?
<do3cc that plugin? There is a working plugin already
<mitsuhiko it is
<__doc__ Kepplar: what type is an item revision?
<mitsuhiko xorAxAx: if you keep clicking on the run gc button :)
<Kepplar generic
<xorAxAx mitsuhiko: yes, i do :)
<do3cc So you have nice code completion, long names are readable trust us as industry code writers
<__doc__ Kepplar: ahum, very sensible, even for generic types you have prefixes
<xorAxAx mitsuhiko: esp. because i have incremental gc
<__doc__ this is soooo way better then hungarian notation
<__doc__ it's a nonsaying obscure prefix with no information value whatsoever
__doc__ claps his hands in admiration
<Kepplar thats because you pretentious twit the code isnt complete nor is my documentation
sensei (n=erik@tribal.metalab.unc.edu) has joined #moin-dev
<Kepplar so if i were you i'll take my head of out my own arse and go and do something productive
<__doc__ Kepplar: your documentation will never be complete, and your code is your best documentation.
<Kepplar eof
<mitsuhiko xorAxAx: peak + 1
<__doc__ Kepplar: if your code isn't readable as it is you're a wittless twit
<xorAxAx no flaming please
<richardb Enough of the name calling.
<__doc__ ^^
<xorAxAx use php and zope channels for that!
<__doc__ he started name calling
<mitsuhiko Kepplar: i'm using moin everyday. i help myself while stopping you to uglify that code :)
<richardb Don't care who started.  Children.
<do3cc he, zope doesnt flame
__doc__ runs around the playground
<__doc__ do3cc: zope does flame when I'm there ^^

Update: Chairos from #pythonpaste gave me a link to a page where Joel explains what Hungarian notation was originally for, and why most people using it are using it wrongly: read article.

WSGI - solving problems

written by Armin Ronacher, on Saturday, June 10, 2006 0:00.

Enough ranting. Let's come with usable solutions. I noticed that .net applications seem to use a provider supplied webinterface on public hosts. That sounds like a possible solution.

Jon Rosebaugh told me that he is working on grail, a python project aiming to provide a solution for the python on public hosts problem.

grail description:
PHP has long been a mainstay of web development due to its ease of deployment; mod_php is available on almost any commodity hosting provider, and the end-user can simply ftp up his webapp and get to work. Similarly, in recent months Ruby on Rails has been appearing on more and more commodity hosts. While Python offers considerable advantages over these two languages, it has been hampered by a lack of support from commodity hosting. I intend to take advantage of existing developments in WSGI such as Paste, flup, and various WSGI-compatible-frameworks in order to develop a simple drop-in method for hosting WSGI webapps in commodity hosting.

Sounds nice. On public hosts here in Austria and Germany too you have just ftp access to your server. The common filesystem layout looks usually like that:

/var
 /www
  /a123456
   /htdocs
   /cgi-bin

The ftp user just can access /var/www/a123456/*. So the grail could provide a folder for dropping wsgi applications as valid python packages or eggs in. The webinterface could allow uploading of those eggs and create an entry in a grail.pth.

For example pocoo isn't zipsafe because of its internal plugin structure. Grail would check for the zipsafe flag, notice that the egg isn't safe to execute and unpack it in /var/www/a123456/grail/packages/Pocoo-1.0-py2.5.egg. Additionally it creates an entry in the .pth.

Now it checks for an entrypoint in the egg called webinstaller. That entry point has to point to a function when defined. Grail will call it after installation. It has to return None for doing nothing or a wsgi application. In case of an wsgi application grail will now serve that application at http://example.com/grail/installer/NameOfEgg. Each time grail gets an request for that url it calls the egg entry point and serves the wsgi app. Since you have to authenticate for accessing grail the installer developer doesn't have to bother about user rights.

The next important entrypoint is for static exports. When installing an application you tell grail on which folder you want the app to work in. For example /pocoo. Now pocoo tells grail that it requires some static files in ./static and the export should point to /var/www/a123456/grail/packages/Pocoo-1.0-py2.5.egg/instance/static. Grail provides a middleware that handles static exports on it's own. But additionally it can put those exports into a small apache.conf webservers can import with a apache directive.

Since all wsgi apps would now work in the same process we have one big problem: There not many process safe applications available. That means for example all applications that use threadlocal objects. Process safe are atm only pocoo and moin as far as I have seen. You would only be able to run one django instance on your grail instance. Only one web.py application, only one sqlobject app and so on...