[mod_python] how to handle xforms with publisher handler

Emiliano Moscato moski666 at gmail.com
Wed Jan 24 21:56:06 EST 2007


Hi all;

Even though nobody answer my question about "application/xml" here is the
0.3 version patch for problem with "multipart/*", available for python 2.3;)
I think that it'll work...
Regards

Emiliano

       # figure out boundary
       try:
           i = ctype.lower().rindex("boundary=")
           end = [ctype.find(';', i+9),ctype.find(' ', i+9)]
           def not_minus_one(x): return x != -1
           filter(not_minus_one, end)
           if len(end) > 0:
               boundary = ctype[i+9:min(end)]
           else:
               boundary = ctype[i+9:]
           if len(boundary) >= 2 and boundary[0] == boundary[-1] == '"':
               boundary = boundary[1:-1]
           boundary = re.compile("--" + re.escape(boundary) + "(--)?\r?\n")

2007/1/24, Graham Dumpleton <grahamd at dscpl.com.au>:
>
> 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
>



-- 
mOsKi
"No hay nada que uno haga mal , lo que hay es poco vino." Autor Anonimo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070124/c1742091/attachment-0001.html


More information about the Mod_python mailing list