[Web-SIG] WebOb API

0 views
Skip to first unread message

Ian Bicking

unread,
Oct 29, 2009, 4:22:54 PM10/29/09
to Web SIG, Armin Ronacher, Jacob Kaplan-Moss, Paste Users, pylons-discuss
Hi all.

So, it's about time that WebOb came to 1.0. For 1.0 I'd like to
settle the API as much as possible. But I'd also like to move further
to getting WebOb used for more frameworks. I don't expect that to
happen before 1.0, but if there are API changes that will make that
easier later, then maybe we can get those in.

While I haven't tracked ongoing changes to frameworks, I did put
together the differences I am aware of in APIs here:

http://pythonpaste.org/webob/differences.html

Some of them are fairly trivial, and could be managed through
subclassing (e.g., req.raw_post_data vs. req.body -- semantically
identical, just different names).

Are there API changes that would help people consider WebOb for other
frameworks? The main ones I can think of is req.FILES, separating out
file uploads from other POST fields. Also then there's the issue of
what kind of object represents files. The finer details of individual
objects are also important, things like the API of req.GET/req.POST
(which are views on ordered dictionaries, and are represented somewhat
differently in different frameworks).

Also I'm planning on introducing a BaseRequest (and *maybe*
BaseResponse) class, that removes some functionality. Specifically
for Repoze they'd like to remove __getattr__ and __setattr__ (which
has some performance implications), and maybe other things are
possible (though removing writers is infeasible, IMHO, as read and
write access are not easily separated, and it would require too much
code duplication).

(Incidentally WebOb is now on bitbucket: http://bitbucket.org/ianb/webob/)

--
Ian Bicking | http://blog.ianbicking.org | http://topplabs.org/civichacker
_______________________________________________
Web-SIG mailing list
Web...@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/python-web-sig-garchive-9074%40googlegroups.com

Chris McDonough

unread,
Oct 29, 2009, 5:01:02 PM10/29/09
to Ian Bicking, pylons-discuss, Paste Users, Jacob Kaplan-Moss, Web SIG
Ian Bicking wrote:
> Also I'm planning on introducing a BaseRequest (and *maybe*
> BaseResponse) class, that removes some functionality. Specifically
> for Repoze they'd like to remove __getattr__ and __setattr__ (which
> has some performance implications),

FTR, after thinking about it, I'm not even sure BaseRequest is necessary for
this purpose. This seems to work too (at least it gets previously visible
setattr/getattr stuff out of the profiling info):

class Request(WebobRequest):
__setattr__ = object.__setattr__
__getattr__ = object.__getattribute__
__delattr__ = object.__delattr__

Reply all
Reply to author
Forward
0 new messages