middleware for the 2 applications needs to be different
anand is the patch by justin davis in git
On Mon, Oct 27, 2008 at 7:16 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:
> hei justin,
> this patch fixes the problem!! it maps to two domains to different
> applications correctly!
> thanks a lot!!!!!
>
> do you know how i can add middleware to each of the two applications?
>
>
>
>
> On Mon, Oct 27, 2008 at 6:08 PM, Justin Davis <[EMAIL PROTECTED]> wrote:
>
>>
>> This is a bug. The subdomain applications try to match on themselves,
>> when they really want to match on their sub-domains. Anand, could you
>> look into this? Here's a patch that fixes this:
>>
>> diff --git a/web/application.py b/web/application.py
>> index 75f6a3b..2b10ad7 100755
>> --- a/web/application.py
>> +++ b/web/application.py
>> @@ -479,8 +479,10 @@ class subdomain_application(application):
>> """
>> def handle(self):
>> host = web.ctx.host.split(':')[0] #strip port
>> - fn, args = self._match(self.mapping, host)
>> - return self._delegate(fn, self.fvars, args)
>> + app = self._match(self.mapping, host)
>> + if app:
>> + return app.handle()
>> + raise notfound
>>
>> def _match(self, mapping, value):
>> for pat, what in utils.group(mapping, 2):
>> @@ -490,8 +492,8 @@ class subdomain_application(application):
>> result = utils.re_compile('^' + pat +
>> '$').match(value)
>>
>> if result: # it's a match
>> - return what, [x and urllib.unquote(x) for x in
>> result.groups()]
>> - return None, None
>> + return what
>> + return None
>>
>>
>> class combine_applications(application):
>>
>> On Oct 25, 2:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>> > if i have a mapping like this:
>> > mapping = (
>> > "www.XX.com", xx_app,
>> > )
>> > it works fine.
>> >
>> > but if i add one more subdomain like this
>> >
>> > mapping = (
>> > "www.XX.com", xx_app,
>> > "www.YY.com", yy_app,
>> > )
>> > app = web.subdomain_application(mapping)
>> >
>> > it just returns 404 not found for all urls of both domain XX and YY
>>
>>
>
> >
>
--
Gpirate the top torrent search engine
http://gpirate.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---