Ian Bicking wrote:
> Huy wrote:
>> Just wondering if Webware could do cherrypy like url mapping. Does the
>> new WSGIKit support this either ?
> In SVN there's URLParser, which allows for a number of kinds of URL
> parsing overrides -- look at WebKit.URLParser.URLParser.parseInit.
This works great. However, I had to change the _FileParser so I can
access the default mapping without cutting and pasting too much code.
It's very minimal. Can anyone see if there is any other way to do this.
def parse(self, trans, requestPath):
# print "FP(%r) parses %r" % (self._path, requestPath)
result = self.parseInit(trans, requestPath)
if result is not None:
assert not requestPath or requestPath.startswith('/'), \
"Not what I expected: %s" % repr(requestPath)
if not requestPath or requestPath == '/':
return self.parseIndex(trans, requestPath)
return self.parseDefault(trans, requestPath)
def parseDefault(self, trans, requestPath):
[...the rest of what parse use to be...]
I am using the urlParserHook. Because of the way webware handles the
servlet i.e calling awake, respond etc. I had to set a custom attribute
on my servlet and in my respond method, I called the method if it was
set. Although it works, its pretty non standard stuff. Is there anyway
of getting this into standard webware in a much more cleaner way. I
think using filters like cherrypy is the way to go.