On Sep 28, 2011, at 8:00 PM, Bruno Rocha wrote: > With this setup, I have no access to admin... > > https://pythonbrasil.web2py.com.br/admin/design/pytalks > > This worked before, any change on routes? > > ---------------------------------------------------------------------------------------------------- > default_application = 'pytalks' # ordinarily set in base routes.py > default_controller = 'default' # ordinarily set in app-specific routes.py > default_function = 'index' # ordinarily set in app-specific routes.py > > > routers = dict( > > # base router > BASE = dict( > default_application = 'pytalks', > domains = { > 'pythonbrasil.web2py.com.br':'pytalks', > 'talks.python.org.br' : 'pytalks' > }, > applications = ['pytalks','admin'], > controllers = 'DEFAULT' > ), > ) >
Below is part of an exchange on the developers list about a change to rewrite's domains processing. I don't think you want (or need) the domains= spec at all in your case. It was a bug in the rewrite code that allowed it to access admin before. I could be missing something, but see if it works if you just take out the domains= spec (or else let me know why that wouldn't work). If for some reason I'm not seeing here you really need the domains= section, you may need to define a third domain for access to the admin app. But I don't offhand see the need for that here. > I'm reposting this on -developers for comment. I don't want to break > anything, but I do think that the current implementation is wrong, and that a > domain map should override a chance app-name match. > > On Aug 16, 2011, at 3:07 PM, vapirix wrote: > >> So I'm attempting to set up the usage scenario of: >> >> domain1.com -> load app 1 >> domain2.com -> load app 2 >> etc. etc. >> >> I need domain1 to NOT have access to app 2, 3, 4, 5, etc. >> >> That all works using the router's "domain" settings. Obviously you run >> into the problem of: domain1.com loads app1, but domain1.com/app2 >> loading app2, so I use "exclusive_domain = True", and then I have to >> do domain1.com/app1/ to load the app without raising an exception, >> which seems counter productive. Besides that, even with >> exclusive_domain = True, I can do domain1.com/app2 to load the second >> app. Is there any way to do what I'm attempting to do here? I'd rather >> not have to set up separate web2py installs for the tons of tiny apps >> I do for my clients that get 1 hit every 6 months. >> >> What can I do here, friends? > > I'm looking at this logic a little more closely, and it seems to me that the > current code is wrong in a way that doesn't have to do with enforcing > exclusive_domain. It's easy to fix, but I wonder if someone is relying on the > wrong behavior. > > The problem is this. Suppose you enable domain routing thus: > > domains = { > "domain1.com" : "app1", > "www.domain1.com" : "app1", > "domain2.com" : "app2", > } > > Right now, domain2.com/app1 will load app1 because the code recognizes app1 > as an app, and that takes priority over the domain. But that's a bug. It > *should* load app2 because the domain specifies it. And in that case, "app1" > in the URL will be most likely interpreted as a *function*, as it should, I > believe. > > That is, the domain should take priority in app determination if the domain > is in the domain map, meaning that we don't really care whether "app1" > happens to be the name of an app in another domain. So (unlike what I said > the other day), this does not immediately result in an exception. It probably > *will* result in an invalid-function exception, but that's just normal > processing. > > And that's why exclusive_domain is only a check on output. In fact, I'm > wondering if it should be the default (or not there at all, but rather always > true).