[mod_python] Beta testers for "vampire::publisher"?

Graham Dumpleton grahamd at dscpl.com.au
Tue Mar 1 05:02:48 EST 2005


On 01/03/2005, at 6:16 PM, Bo Lorentsen wrote:
> Btw. regarding your form element parsing (the dot notation). it is  
> possible to make a  "dict.element" = "data -> dict =  
> {'element':data}", but how about sequences like fks :
>
> seq.index.element = data
>
> that may in python become :
>
> seq[ index ] =  {'element':data}
>
> I use somthing like this for "onemany" DB relations in my current  
> code, to repeate a block of ellements. Together with my data  
> abstraction layer (that also need documentation :-)), this makes a  
> really nice and easy way to renter and edit database content.

It isn't actually my notation, I got permission to use code written by  
someone
else which did it as I couldn't see that I could do any better. The  
original
code I used was written by Ian Bicking and is at:

   http://svn.colorstudy.com/trunk/Validator/validator/variabledecode.py

Lists and dictionaries can nest if that is what you mean. Click on the  
link:

    
http://www.dscpl.com.au/projects/vampire/examples-01/form-values.html? 
seq.index.element=data

It yields:

   seq = {'index': {'element': 'data'}}

The top level is a dictionary and not an array. If you wanted an array,  
try:

    
http://www.dscpl.com.au/projects/vampire/examples-01/form-values.html? 
seq-1.element=data1&seq-2.element=data2

This yields:

   seq = [{'element': 'data1'}, {'element': 'data2'}]

Ie. array of dictionaries.

Anyway, read the documentation in the original source and then play  
with that
URL, adding whatever variation of form parameters you want to try out  
and it
will tell you what they get converted to.

BTW, decided that I should add an option to Vampire to turn off this  
more
advanced form parameter parsing if not wanted. When turned off, it will
behave just like mod_python.publisher.

Graham



More information about the Mod_python mailing list