Nick
nick at dd.revealed.net
Wed Jan 24 17:50:44 EST 2007
You probably could adapt this to use Set (in the sets module), which became available in the standard lib in 2.3. Nick Graham Dumpleton wrote: > Thanks, I've added a link to this in issue: > > http://issues.apache.org/jira/browse/MODPYTHON-210 > > Note though that patch as is can't be used as it looks like you use "set" which only > newer versions of Python support. Python 2.3 is still supported by mod_python. > > A similar thing to this splitting up has to be done for cookies, so something like > the Cookie._parse_cookie might be able to be done. > > Graham > > Emiliano Moscato wrote .. >> Hi, I'm sorry, I've forgot to send this lines: >> >> # figure out boundary >> try: >> i = ctype.lower().rindex("boundary=") >> end = set([ctype.find(';', i+9), ctype.find(' ', i+9)]) >> end.discard(-1) >> if len(end) > 0: >> boundary = ctype[i+9:min(list(end))] >> else: >> boundary = ctype[i+9:] >> boundary_str = boundary >> if len(boundary) >= 2 and boundary[0] == boundary[-1] == '"': >> boundary = boundary[1:-1] >> boundary = re.compile("--" + re.escape(boundary) + "(--)?\r?\n") >> >> >> except ValueError: >> raise apache.SERVER_RETURN, apache.HTTP_BAD_REQUEST >> >> >> Is a little long, but I didn't find a shorter way. >> >> Graham et all, I'm interested on the another tip (how to treat xml dom >> models), I'd like to know your opinion about my opinion sent with the first >> bugfix. I'd like to use mod_python (and publisher handler if possible) >> in >> our framework. >> Thanks >> >> Emiliano >> >> 2007/1/17, Graham Dumpleton <grahamd at dscpl.com.au>: >>> Emiliano Moscato wrote .. >>>> Hi; >>>> >>>> I've followed my tiny work with FieldStorage. >>>> I changed the line: >>>> boundary = ctype[i+9:] >>>> for: >>>> boundary = ctype[i+9:ctype.find(';',i+9)] >>>> to fix the problem with boundary. >>> I don't think this will always work. Where there is no semicolon then >> the >>> result would be: >>> >>> boundary = ctype[i+9:-1] >>> >>> This would have the affect of dropping off the last character in the >> value >>> which may be part of the boundary tag or the quote which might surround >>> it. >>> >>> Graham >>> >>> >>>> I've tried to use this method without any other change to FieldStorage >>>> and >>>> works. I only need this bugfix and it is a good new for me. >>>> On the other hand, I was thinking about the matter with >>> "application/xml" >>>> serialize method and the name of the method says all: who uses >>>> "application/xml" as serialize method waits in the server for an xml >>>> document, not for its mapping to a dict, and it have nothing to do >> with >>>> xforms. >>>> For example: cherryPy, where I come from, uses the same philosophy >> of >>> put >>>> the form fields as attributes of an object, but when it receives an >>>> "application/xml" puts it available in "threadData" attribute. >>>> Thanks for the attention :) >>>> >>>> Emiliano >>>> >> >> -- >> mOsKi >> "No hay nada que uno haga mal , lo que hay es poco vino." Autor Anonimo > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|