On Nov 17, 2011, at 8:48 AM, Richard Baron Penman wrote:

> OK domain1/sales
> (These are just examples - if would be helpful to have the exact
> settings and domains I am using we can have a private conversation.)
> 
> The apps have different controllers.

With this router:

routers = dict(
 BASE  = dict(
    domains = {
        'domain1' : 'forum',
        'domain2' : 'sales',
    },
 ),
)

The logic for domain1/sales says this: It's domain1, so the app must be 
'forum'. (If you've specified 'domains=', the router takes that to be 
authoritative.)

There's no forum/sales controller, so sales must be a function in the default 
controller of forum: forum/default/sales.

Which app/controller/function do you expect domain1/sales to resolve to?

> 
> Richard
> 
> 
> On Fri, Nov 18, 2011 at 1:31 AM, Jonathan Lundell <jlund...@pobox.com> wrote:
>> On Nov 17, 2011, at 8:20 AM, Richard Baron Penman wrote:
>> 
>>> in fact Bruno's suggestion to use the controllers variable does work for me.
>>> Previously I used what you suggest (see first post in this thread) and
>>> then only the default controller was exposed.
>>> 
>>> What error? Accessing domain/sales before returned this error:
>>> invalid function (default/sales)
>> 
>> domain/sales? Not domain1 or domain2?
>> 
>> Do your two apps have exactly the same list of controllers?
>> 
>>> 
>>> Richard
>>> 
>>> 
>>> On Fri, Nov 18, 2011 at 12:24 AM, Jonathan Lundell <jlund...@pobox.com> 
>>> wrote:
>>>> On Nov 16, 2011, at 11:53 PM, Richard Baron Penman wrote:
>>>> 
>>>>> what web2py version are you using? I have 1.99.2
>>>>> 
>>>>> 
>>>>> This is the only variable I have defined in routes.py:
>>>>> 
>>>>> routers = dict(
>>>>>  BASE  = dict(
>>>>>      domains = {
>>>>>          'domain1' : 'forum',
>>>>>          'domain2' : 'sales',
>>>>>      },
>>>>> 
>>>>>      controllers = ['default', 'appadmin', 'view'], # also tried
>>>>> 'ALL' but did not work
>>>>>  ),
>>>>> )
>>>> 
>>>> Defining controllers= in the BASE router won't work. I'd expect this to 
>>>> work:
>>>> 
>>>> routers = dict(
>>>>  BASE  = dict(
>>>>     domains = {
>>>>         'domain1' : 'forum',
>>>>         'domain2' : 'sales',
>>>>     },
>>>>  ),
>>>> )
>>>> 
>>>> With that router, what breaks, exactly? What incoming URL and what error 
>>>> message?
>>>> 
>>>>> 
>>>>> 
>>>>> On Thu, Nov 17, 2011 at 12:56 AM, Jonathan Lundell <jlund...@pobox.com> 
>>>>> wrote:
>>>>>> On Nov 16, 2011, at 5:32 AM, Richard Baron Penman wrote:
>>>>>> 
>>>>>>> I found listing the controllers explicitly as Bruno mentioned fixed the 
>>>>>>> problem.
>>>>>>> Previously domain/non-default-controller returned: invalid function
>>>>>>> (default/non-default-controller)
>>>>>>> I would expect all controllers to work by default.
>>>>>> 
>>>>>> I wrote a unit test that isn't seeing a problem. Would you please 
>>>>>> suggest an input URL that would cause the problem?
>>>>>> 
>>>>>> Thanks.
>>>>>> 
>>>>>> 
>>>>>>    def test_router_domains_fs(self):
>>>>>>        '''
>>>>>>        Test URLs that map domains using test filesystem layout
>>>>>>        '''
>>>>>>        routers = dict(
>>>>>>            BASE = dict(
>>>>>>                domains = {
>>>>>>                    "domain1.com" : "admin",
>>>>>>                    "domain2.com" : "welcome",
>>>>>>                },
>>>>>>            ),
>>>>>>        )
>>>>>> 
>>>>>>        load(rdict=routers)
>>>>>>        self.assertEqual(filter_url('http://domain1.com'), 
>>>>>> '/admin/default/index')
>>>>>>        self.assertEqual(filter_url('http://domain2.com'), 
>>>>>> '/welcome/default/index')
>>>>>>        self.assertEqual(filter_url('http://domain1.com/gae'), 
>>>>>> '/admin/gae/index')
>>>>>>        self.assertEqual(filter_url('http://domain2.com/other'), 
>>>>>> '/welcome/other/index')
>>>>>>        self.assertEqual(filter_url('http://domain1.com/gae/f1'), 
>>>>>> '/admin/gae/f1')
>>>>>>        self.assertEqual(filter_url('http://domain2.com/f2'), 
>>>>>> '/welcome/default/f2')
>>>>>>        self.assertEqual(filter_url('http://domain2.com/other/f3'), 
>>>>>> '/welcome/other/f3')
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> 
>>>>>>> Richard
>>>>>>> 
>>>>>>> 
>>>>>>> On Wed, Nov 16, 2011 at 2:36 PM, Jonathan Lundell <jlund...@pobox.com> 
>>>>>>> wrote:
>>>>>>>> On Nov 15, 2011, at 8:54 PM, Bruno Rocha wrote:
>>>>>>>> 
>>>>>>>>> On Wed, Nov 16, 2011 at 2:34 AM, Massimo Di Pierro 
>>>>>>>>> <massimo.dipie...@gmail.com> wrote:
>>>>>>>>> this should not be the case. if it is is a bug.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> I found this some time ago and I tough it was the default behaviour.
>>>>>>>>> 
>>>>>>>>> for the following worked
>>>>>>>>> 
>>>>>>>>> routers = dict(
>>>>>>>>>   BASE  = dict(
>>>>>>>>>       domains = {
>>>>>>>>> 
>>>>>>>>> 'domain1.com' : 'app1',
>>>>>>>>> 
>>>>>>>>> 'domain2.com' : 'app2',
>>>>>>>>> 
>>>>>>>>>       },
>>>>>>>>>      controllers=['default', 'appadmin', ..., ..., ..., ]
>>>>>>>>>   ),
>>>>>>>>> )
>>>>>>>>> 
>>>>>>>>> I has to list every controller, also functions
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> It shouldn't be necessary to list the controllers (and it's not a good 
>>>>>>>> idea to list controllers explicitly in the BASE router; if you need a 
>>>>>>>> controller list, put it in an app-specific section).
>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>>> 
>> 
>> 
>> 


Reply via email to