Re: [web2py] How to remove 'default' from all URLs?

2012-06-25 Thread Alec Taylor
Hmm, I'm not sure.

I'm running the latest trunk from github:
https://github.com/web2py/web2py - If that makes a difference.

Yes, the /profile/ URL is the one giving me trouble. It could be
something on the facebook side, though I'm not sure.

On Mon, Jun 25, 2012 at 7:04 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 24, 2012, at 2:02 PM, Jonathan Lundell wrote:

 On Jun 24, 2012, at 1:38 PM, Jonathan Lundell wrote:

 On Jun 24, 2012, at 9:30 AM, Alec Taylor wrote:

 To be as clear as possible, here is a gist containing all the files I
 changed (for a test-case) since creating this simple new project:

 https://gist.github.com/61a6b9f8e71f706e4255

 I installed that app under 1.99.7 (I had to disable signature=False and 
 turn off the Facebook stuff; no libraries) and URL(f='profile') returned 
 '/profile'.

 Ditto for the current nightly build (actually June 9), with 
 signature=False turned back on.

 Are you using something more current than that? I'm doubtful that the 
 presence of the FB logic would affect things one way or the other.

 My code:

 import logging
 logger = logging.getLogger(web2py.app.social)

 ...

 logger.error(db.py: %s % URL(f='profile'))

 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-25 Thread Jonathan Lundell
On Jun 24, 2012, at 11:26 PM, Alec Taylor wrote:
 
 Hmm, I'm not sure.
 
 I'm running the latest trunk from github:
 https://github.com/web2py/web2py - If that makes a difference.
 
 Yes, the /profile/ URL is the one giving me trouble. It could be
 something on the facebook side, though I'm not sure.

I'll make one more run, with the current trunk, to see whether any recent 
changes might have caused a regression.

Would you please try logging the result of a URL call, either in your model or 
controller (I tried both)? Use whatever logging mechanism is convenient for 
you. 

If those steps don't help, I'll ask you to insert some logging into the routing 
code itself so we can see what's going on.

 
 On Mon, Jun 25, 2012 at 7:04 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 24, 2012, at 2:02 PM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 1:38 PM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 9:30 AM, Alec Taylor wrote:
 
 To be as clear as possible, here is a gist containing all the files I
 changed (for a test-case) since creating this simple new project:
 
 https://gist.github.com/61a6b9f8e71f706e4255
 
 I installed that app under 1.99.7 (I had to disable signature=False and 
 turn off the Facebook stuff; no libraries) and URL(f='profile') returned 
 '/profile'.
 
 Ditto for the current nightly build (actually June 9), with 
 signature=False turned back on.
 
 Are you using something more current than that? I'm doubtful that the 
 presence of the FB logic would affect things one way or the other.
 
 My code:
 
 import logging
 logger = logging.getLogger(web2py.app.social)
 
 ...
 
 logger.error(db.py: %s % URL(f='profile'))
 


-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-25 Thread Jonathan Lundell
On Jun 25, 2012, at 6:07 AM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 11:26 PM, Alec Taylor wrote:
 
 Hmm, I'm not sure.
 
 I'm running the latest trunk from github:
 https://github.com/web2py/web2py - If that makes a difference.
 
 Yes, the /profile/ URL is the one giving me trouble. It could be
 something on the facebook side, though I'm not sure.
 
 I'll make one more run, with the current trunk, to see whether any recent 
 changes might have caused a regression.
 
 Would you please try logging the result of a URL call, either in your model 
 or controller (I tried both)? Use whatever logging mechanism is convenient 
 for you. 
 
 If those steps don't help, I'll ask you to insert some logging into the 
 routing code itself so we can see what's going on.

Report: the 18 June trunk works fine for me.

-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-25 Thread Alec Taylor
print auth.settings.login_next
/default/profile

On Mon, Jun 25, 2012 at 11:37 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 25, 2012, at 6:07 AM, Jonathan Lundell wrote:

 On Jun 24, 2012, at 11:26 PM, Alec Taylor wrote:

 Hmm, I'm not sure.

 I'm running the latest trunk from github:
 https://github.com/web2py/web2py - If that makes a difference.

 Yes, the /profile/ URL is the one giving me trouble. It could be
 something on the facebook side, though I'm not sure.

 I'll make one more run, with the current trunk, to see whether any recent 
 changes might have caused a regression.

 Would you please try logging the result of a URL call, either in your model 
 or controller (I tried both)? Use whatever logging mechanism is convenient 
 for you.

 If those steps don't help, I'll ask you to insert some logging into the 
 routing code itself so we can see what's going on.

 Report: the 18 June trunk works fine for me.

 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-25 Thread Jonathan Lundell
On Jun 25, 2012, at 7:48 AM, Alec Taylor wrote:
 
 print auth.settings.login_next
 /default/profile

Would you also print the direct result of a separate URL call, with %s? Thanks.

 
 On Mon, Jun 25, 2012 at 11:37 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 25, 2012, at 6:07 AM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 11:26 PM, Alec Taylor wrote:
 
 Hmm, I'm not sure.
 
 I'm running the latest trunk from github:
 https://github.com/web2py/web2py - If that makes a difference.
 
 Yes, the /profile/ URL is the one giving me trouble. It could be
 something on the facebook side, though I'm not sure.
 
 I'll make one more run, with the current trunk, to see whether any recent 
 changes might have caused a regression.
 
 Would you please try logging the result of a URL call, either in your model 
 or controller (I tried both)? Use whatever logging mechanism is convenient 
 for you.
 
 If those steps don't help, I'll ask you to insert some logging into the 
 routing code itself so we can see what's going on.
 
 Report: the 18 June trunk works fine for me.
 


-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-25 Thread Jonathan Lundell
On Jun 25, 2012, at 7:48 AM, Alec Taylor wrote:
 
 print auth.settings.login_next
 /default/profile

Is it possible that you have a file controllers/profile.py? 

If you do, the router will not omit 'default' in the above case because it 
would be ambiguous.

 
 On Mon, Jun 25, 2012 at 11:37 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 25, 2012, at 6:07 AM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 11:26 PM, Alec Taylor wrote:
 
 Hmm, I'm not sure.
 
 I'm running the latest trunk from github:
 https://github.com/web2py/web2py - If that makes a difference.
 
 Yes, the /profile/ URL is the one giving me trouble. It could be
 something on the facebook side, though I'm not sure.
 
 I'll make one more run, with the current trunk, to see whether any recent 
 changes might have caused a regression.
 
 Would you please try logging the result of a URL call, either in your model 
 or controller (I tried both)? Use whatever logging mechanism is convenient 
 for you.
 
 If those steps don't help, I'll ask you to insert some logging into the 
 routing code itself so we can see what's going on.
 
 Report: the 18 June trunk works fine for me.
 


-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-25 Thread Alec Taylor
On Tue, Jun 26, 2012 at 12:59 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 25, 2012, at 7:48 AM, Alec Taylor wrote:

 print auth.settings.login_next
 /default/profile

 Is it possible that you have a file controllers/profile.py?

.

That was the case. I thought I'd renamed everything to profile2 but it
seemed that I had only renamed my views. Thanks a heap for finding the
problem!

There is still the secondary problem of #_=_ being appended, but
that isn't really an issue so I'm happy to call case closed!

:D


 If you do, the router will not omit 'default' in the above case because it 
 would be ambiguous.


 On Mon, Jun 25, 2012 at 11:37 PM, Jonathan Lundell jlund...@pobox.com 
 wrote:
 On Jun 25, 2012, at 6:07 AM, Jonathan Lundell wrote:

 On Jun 24, 2012, at 11:26 PM, Alec Taylor wrote:

 Hmm, I'm not sure.

 I'm running the latest trunk from github:
 https://github.com/web2py/web2py - If that makes a difference.

 Yes, the /profile/ URL is the one giving me trouble. It could be
 something on the facebook side, though I'm not sure.

 I'll make one more run, with the current trunk, to see whether any recent 
 changes might have caused a regression.

 Would you please try logging the result of a URL call, either in your 
 model or controller (I tried both)? Use whatever logging mechanism is 
 convenient for you.

 If those steps don't help, I'll ask you to insert some logging into the 
 routing code itself so we can see what's going on.

 Report: the 18 June trunk works fine for me.



 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-24 Thread Jonathan Lundell
On Jun 24, 2012, at 9:30 AM, Alec Taylor wrote:
 
 To be as clear as possible, here is a gist containing all the files I
 changed (for a test-case) since creating this simple new project:
 
 https://gist.github.com/61a6b9f8e71f706e4255

I installed that app under 1.99.7 (I had to disable signatures=False and turn 
off the Facebook stuff; no libraries) and URL(f='profile') returned '/profile'.

-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-24 Thread Jonathan Lundell
On Jun 24, 2012, at 1:38 PM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 9:30 AM, Alec Taylor wrote:
 
 To be as clear as possible, here is a gist containing all the files I
 changed (for a test-case) since creating this simple new project:
 
 https://gist.github.com/61a6b9f8e71f706e4255
 
 I installed that app under 1.99.7 (I had to disable signature=False and turn 
 off the Facebook stuff; no libraries) and URL(f='profile') returned 
 '/profile'.

Ditto for the current nightly build (actually June 9), with signature=False 
turned back on.

Are you using something more current than that? I'm doubtful that the presence 
of the FB logic would affect things one way or the other.

-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-24 Thread Jonathan Lundell
On Jun 24, 2012, at 2:02 PM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 1:38 PM, Jonathan Lundell wrote:
 
 On Jun 24, 2012, at 9:30 AM, Alec Taylor wrote:
 
 To be as clear as possible, here is a gist containing all the files I
 changed (for a test-case) since creating this simple new project:
 
 https://gist.github.com/61a6b9f8e71f706e4255
 
 I installed that app under 1.99.7 (I had to disable signature=False and turn 
 off the Facebook stuff; no libraries) and URL(f='profile') returned 
 '/profile'.
 
 Ditto for the current nightly build (actually June 9), with signature=False 
 turned back on.
 
 Are you using something more current than that? I'm doubtful that the 
 presence of the FB logic would affect things one way or the other.

My code:

import logging
logger = logging.getLogger(web2py.app.social)

...

logger.error(db.py: %s % URL(f='profile'))

-- 





[web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Alec Taylor
My web2py\routes.py:

routers = dict( BASE=dict( default_application='social',
default_controller='default', default_function='index' ) )
myapps = ['social']
routes_in = [
  ('/admin/$anything', '/admin/$anything'),
]
for app in myapps:
routes_in += [ ('/%s/static/$anything' % app,
'/%s/static/$anything' % app), ('/%s/appadmin/$anything' % app,
'/%s/appadmin/$anything' % app), ('/%s/$anything' % app,
'/%s/default/$anything' % app) ]
routes_out = [(b, a) for (a, b) in routes_in]

It correctly defaults the landing page to the 'social' app, but it
isn't removing 'default' from my URLs.

(I got the above from
https://groups.google.com/forum/#!topic/web2py/QU71v2-GFaM)

How can I remove 'default' from my URLs?

Thanks for all suggestions,

Alec Taylor

-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Jonathan Lundell
On Jun 22, 2012, at 3:08 AM, Alec Taylor wrote:
 
 My web2py\routes.py:
 
 routers = dict( BASE=dict( default_application='social',
 default_controller='default', default_function='index' ) )
 myapps = ['social']
 routes_in = [
  ('/admin/$anything', '/admin/$anything'),
 ]
 for app in myapps:
routes_in += [ ('/%s/static/$anything' % app,
 '/%s/static/$anything' % app), ('/%s/appadmin/$anything' % app,
 '/%s/appadmin/$anything' % app), ('/%s/$anything' % app,
 '/%s/default/$anything' % app) ]
 routes_out = [(b, a) for (a, b) in routes_in]
 
 It correctly defaults the landing page to the 'social' app, but it
 isn't removing 'default' from my URLs.
 
 (I got the above from
 https://groups.google.com/forum/#!topic/web2py/QU71v2-GFaM)
 
 How can I remove 'default' from my URLs?
 
 Thanks for all suggestions,

Don't mix the two routers. In particular, don't define routers if you're going 
to define routes_in/out.

All you need is:

routers = dict(
BASE = dict(
default_application = 'social',
),
)

-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Alec Taylor
Just tried that, it's still prepending the URL with default.

E.g.: http://localhost/default/profile rather than http://localhost/profile

On Fri, Jun 22, 2012 at 10:57 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 3:08 AM, Alec Taylor wrote:

 My web2py\routes.py:

 routers = dict( BASE=dict( default_application='social',
 default_controller='default', default_function='index' ) )
 myapps = ['social']
 routes_in = [
  ('/admin/$anything', '/admin/$anything'),
 ]
 for app in myapps:
    routes_in += [ ('/%s/static/$anything' % app,
 '/%s/static/$anything' % app), ('/%s/appadmin/$anything' % app,
 '/%s/appadmin/$anything' % app), ('/%s/$anything' % app,
 '/%s/default/$anything' % app) ]
 routes_out = [(b, a) for (a, b) in routes_in]

 It correctly defaults the landing page to the 'social' app, but it
 isn't removing 'default' from my URLs.

 (I got the above from
 https://groups.google.com/forum/#!topic/web2py/QU71v2-GFaM)

 How can I remove 'default' from my URLs?

 Thanks for all suggestions,

 Don't mix the two routers. In particular, don't define routers if you're 
 going to define routes_in/out.

 All you need is:

 routers = dict(
    BASE = dict(
        default_application = 'social',
    ),
 )

 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Jonathan Lundell
On Jun 22, 2012, at 7:06 AM, Alec Taylor wrote:
 Just tried that, it's still prepending the URL with default.
 
 E.g.: http://localhost/default/profile rather than http://localhost/profile

If you want the router to omit the default controller when you specify a 
non-default function, then you need to list your functions.

routers = dict(
   BASE = dict(
   default_application = 'social',
   functions = ['index', 'profile', ... ],
   ),
)

The functions list must be a complete list of the callable functions in the 
default controller.

Otherwise, the router could ambiguously interpret http://localhost/profile as 
/myapp/default/index/profile.

You can extend this functionality by defining functions as a dict of lists, 
where the dict keys are controller names. That allows dropping of functions in 
non-default controllers. The hazard of doing this is that the function list(s) 
really, really must be complete.


 
 On Fri, Jun 22, 2012 at 10:57 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 3:08 AM, Alec Taylor wrote:
 
 My web2py\routes.py:
 
 routers = dict( BASE=dict( default_application='social',
 default_controller='default', default_function='index' ) )
 myapps = ['social']
 routes_in = [
  ('/admin/$anything', '/admin/$anything'),
 ]
 for app in myapps:
routes_in += [ ('/%s/static/$anything' % app,
 '/%s/static/$anything' % app), ('/%s/appadmin/$anything' % app,
 '/%s/appadmin/$anything' % app), ('/%s/$anything' % app,
 '/%s/default/$anything' % app) ]
 routes_out = [(b, a) for (a, b) in routes_in]
 
 It correctly defaults the landing page to the 'social' app, but it
 isn't removing 'default' from my URLs.
 
 (I got the above from
 https://groups.google.com/forum/#!topic/web2py/QU71v2-GFaM)
 
 How can I remove 'default' from my URLs?
 
 Thanks for all suggestions,
 
 Don't mix the two routers. In particular, don't define routers if you're 
 going to define routes_in/out.
 
 All you need is:
 
 routers = dict(
BASE = dict(
default_application = 'social',
),
 )
 
 --



-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Alec Taylor
I modified the route.py as you suggested:

routers = dict(
BASE=dict(
default_application='social',
functions = ['index', 'profile', 'user'],
)
)

Yet the URL continues to present at: http://brian.com/default/profile#_=_

On Sat, Jun 23, 2012 at 12:15 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 7:06 AM, Alec Taylor wrote:
 Just tried that, it's still prepending the URL with default.

 E.g.: http://localhost/default/profile rather than http://localhost/profile

 If you want the router to omit the default controller when you specify a 
 non-default function, then you need to list your functions.

 routers = dict(
   BASE = dict(
       default_application = 'social',
       functions = ['index', 'profile', ... ],
   ),
 )

 The functions list must be a complete list of the callable functions in the 
 default controller.

 Otherwise, the router could ambiguously interpret http://localhost/profile as 
 /myapp/default/index/profile.

 You can extend this functionality by defining functions as a dict of lists, 
 where the dict keys are controller names. That allows dropping of functions 
 in non-default controllers. The hazard of doing this is that the function 
 list(s) really, really must be complete.



 On Fri, Jun 22, 2012 at 10:57 PM, Jonathan Lundell jlund...@pobox.com 
 wrote:
 On Jun 22, 2012, at 3:08 AM, Alec Taylor wrote:

 My web2py\routes.py:

 routers = dict( BASE=dict( default_application='social',
 default_controller='default', default_function='index' ) )
 myapps = ['social']
 routes_in = [
  ('/admin/$anything', '/admin/$anything'),
 ]
 for app in myapps:
    routes_in += [ ('/%s/static/$anything' % app,
 '/%s/static/$anything' % app), ('/%s/appadmin/$anything' % app,
 '/%s/appadmin/$anything' % app), ('/%s/$anything' % app,
 '/%s/default/$anything' % app) ]
 routes_out = [(b, a) for (a, b) in routes_in]

 It correctly defaults the landing page to the 'social' app, but it
 isn't removing 'default' from my URLs.

 (I got the above from
 https://groups.google.com/forum/#!topic/web2py/QU71v2-GFaM)

 How can I remove 'default' from my URLs?

 Thanks for all suggestions,

 Don't mix the two routers. In particular, don't define routers if you're 
 going to define routes_in/out.

 All you need is:

 routers = dict(
    BASE = dict(
        default_application = 'social',
    ),
 )

 --



 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Alec Taylor
(brian.com is an entry in my /etc/hosts pointing to 127.0.0.1 as a
workaround for localhost with Facebook OAuth2)

On Sat, Jun 23, 2012 at 12:29 AM, Alec Taylor alec.tayl...@gmail.com wrote:
 I modified the route.py as you suggested:

 routers = dict(
    BASE=dict(
        default_application='social',
        functions = ['index', 'profile', 'user'],
    )
 )

 Yet the URL continues to present at: http://brian.com/default/profile#_=_

 On Sat, Jun 23, 2012 at 12:15 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 7:06 AM, Alec Taylor wrote:
 Just tried that, it's still prepending the URL with default.

 E.g.: http://localhost/default/profile rather than http://localhost/profile

 If you want the router to omit the default controller when you specify a 
 non-default function, then you need to list your functions.

 routers = dict(
   BASE = dict(
       default_application = 'social',
       functions = ['index', 'profile', ... ],
   ),
 )

 The functions list must be a complete list of the callable functions in the 
 default controller.

 Otherwise, the router could ambiguously interpret http://localhost/profile 
 as /myapp/default/index/profile.

 You can extend this functionality by defining functions as a dict of lists, 
 where the dict keys are controller names. That allows dropping of functions 
 in non-default controllers. The hazard of doing this is that the function 
 list(s) really, really must be complete.



 On Fri, Jun 22, 2012 at 10:57 PM, Jonathan Lundell jlund...@pobox.com 
 wrote:
 On Jun 22, 2012, at 3:08 AM, Alec Taylor wrote:

 My web2py\routes.py:

 routers = dict( BASE=dict( default_application='social',
 default_controller='default', default_function='index' ) )
 myapps = ['social']
 routes_in = [
  ('/admin/$anything', '/admin/$anything'),
 ]
 for app in myapps:
    routes_in += [ ('/%s/static/$anything' % app,
 '/%s/static/$anything' % app), ('/%s/appadmin/$anything' % app,
 '/%s/appadmin/$anything' % app), ('/%s/$anything' % app,
 '/%s/default/$anything' % app) ]
 routes_out = [(b, a) for (a, b) in routes_in]

 It correctly defaults the landing page to the 'social' app, but it
 isn't removing 'default' from my URLs.

 (I got the above from
 https://groups.google.com/forum/#!topic/web2py/QU71v2-GFaM)

 How can I remove 'default' from my URLs?

 Thanks for all suggestions,

 Don't mix the two routers. In particular, don't define routers if you're 
 going to define routes_in/out.

 All you need is:

 routers = dict(
    BASE = dict(
        default_application = 'social',
    ),
 )

 --



 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Jonathan Lundell
On Jun 22, 2012, at 7:29 AM, Alec Taylor wrote:
 
 I modified the route.py as you suggested:
 
 routers = dict(
BASE=dict(
default_application='social',
functions = ['index', 'profile', 'user'],
)
 )
 
 Yet the URL continues to present at: http://brian.com/default/profile#_=_

Did you restart web2py (or otherwise reload the routing table)? You'll need to 
do that.

The router I gave you (above) is slightly defective (though it shouldn't have 
kept function removal from working). The functions info should go in an 
app-specific section, thus:

routers = dict(
   BASE=dict(
   default_application='social',
   )
   social=dict(
   functions = ['index', 'profile', 'user'],
   )
)

-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Alec Taylor
I got a syntax error on your last code modification (pointing out the
= on social=).

And yes, I have restarted the server. (I even rebooted my machine [for
an unrelated reason])

Still being directed to http://brian.com/default/profile#_=_ rather
than http://brian.com/profile

On Sat, Jun 23, 2012 at 12:32 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 7:29 AM, Alec Taylor wrote:

 I modified the route.py as you suggested:

 routers = dict(
    BASE=dict(
        default_application='social',
        functions = ['index', 'profile', 'user'],
    )
 )

 Yet the URL continues to present at: http://brian.com/default/profile#_=_

 Did you restart web2py (or otherwise reload the routing table)? You'll need 
 to do that.

 The router I gave you (above) is slightly defective (though it shouldn't have 
 kept function removal from working). The functions info should go in an 
 app-specific section, thus:

 routers = dict(
   BASE=dict(
       default_application='social',
   )
   social=dict(
       functions = ['index', 'profile', 'user'],
   )
 )

 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Jonathan Lundell
On Jun 22, 2012, at 10:02 AM, Alec Taylor wrote:
 
 I got a syntax error on your last code modification (pointing out the
 = on social=).

My dumb mistake; you need a comma after the BASE dict:

routers = dict(
  BASE=dict(
  default_application='social',
  ),
  social=dict(
  functions = ['index', 'profile', 'user'],
  )
)

I'll try adding your case to the unit tests and see what's what. I might not be 
able to do it right away, but soon.


 
 And yes, I have restarted the server. (I even rebooted my machine [for
 an unrelated reason])
 
 Still being directed to http://brian.com/default/profile#_=_ rather
 than http://brian.com/profile
 
 On Sat, Jun 23, 2012 at 12:32 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 7:29 AM, Alec Taylor wrote:
 
 I modified the route.py as you suggested:
 
 routers = dict(
BASE=dict(
default_application='social',
functions = ['index', 'profile', 'user'],
)
 )
 
 Yet the URL continues to present at: http://brian.com/default/profile#_=_
 


-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Alec Taylor
(just tried that, didn't work) - Looking forward to when you get the
chance to pass it through unit-tests :)

On Sat, Jun 23, 2012 at 3:06 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 10:02 AM, Alec Taylor wrote:

 I got a syntax error on your last code modification (pointing out the
 = on social=).

 My dumb mistake; you need a comma after the BASE dict:

 routers = dict(
  BASE=dict(
      default_application='social',
  ),
  social=dict(
      functions = ['index', 'profile', 'user'],
  )
 )

 I'll try adding your case to the unit tests and see what's what. I might not 
 be able to do it right away, but soon.



 And yes, I have restarted the server. (I even rebooted my machine [for
 an unrelated reason])

 Still being directed to http://brian.com/default/profile#_=_ rather
 than http://brian.com/profile

 On Sat, Jun 23, 2012 at 12:32 AM, Jonathan Lundell jlund...@pobox.com 
 wrote:
 On Jun 22, 2012, at 7:29 AM, Alec Taylor wrote:

 I modified the route.py as you suggested:

 routers = dict(
    BASE=dict(
        default_application='social',
        functions = ['index', 'profile', 'user'],
    )
 )

 Yet the URL continues to present at: http://brian.com/default/profile#_=_



 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Jonathan Lundell
On Jun 22, 2012, at 11:00 AM, Alec Taylor wrote:
 
 (just tried that, didn't work) - Looking forward to when you get the
 chance to pass it through unit-tests :)

OK, I tried it and it seemed to work OK. Here's my test case:

router = dict(
   BASE = dict(
   default_application = 'init',
   applications = 'INIT',
   ),
   init = dict(
   controllers = ['default', 'ctr'],
   functions = ['index','user','register','basicRegister',
   'download','call','data','error']
   ),
)

The applications= and controllers= lines are in there because of the unit test 
environment; you don't need them as a rule.

The test case:

self.assertEqual(str(URL(a='init', c='default', f='register')), 
/register)

How are you generating your URL? You have to use URL() to do it; that's where 
the router gets invoked.

-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Alec Taylor
In my models/db.py I have this line:

auth.settings.login_next = URL(f='profile')

The profile function is defined in controllers/default.py

On Sat, Jun 23, 2012 at 4:46 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 11:00 AM, Alec Taylor wrote:

 (just tried that, didn't work) - Looking forward to when you get the
 chance to pass it through unit-tests :)

 OK, I tried it and it seemed to work OK. Here's my test case:

        router = dict(
           BASE = dict(
               default_application = 'init',
                   applications = 'INIT',
           ),
           init = dict(
                   controllers = ['default', 'ctr'],
                   functions = ['index','user','register','basicRegister',
                       'download','call','data','error']
           ),
        )

 The applications= and controllers= lines are in there because of the unit 
 test environment; you don't need them as a rule.

 The test case:

        self.assertEqual(str(URL(a='init', c='default', f='register')), 
 /register)

 How are you generating your URL? You have to use URL() to do it; that's where 
 the router gets invoked.

 --




-- 





Re: [web2py] How to remove 'default' from all URLs?

2012-06-22 Thread Jonathan Lundell
On Jun 22, 2012, at 11:57 AM, Alec Taylor wrote:
 In my models/db.py I have this line:
 
 auth.settings.login_next = URL(f='profile')

You might want to explicitly set the controller on that line, unless you have 
only one controller. As a practical matter it may not be an issue, since it's 
quite possible that the current controller is 'default' any time you care about 
login_next, but in general you could have any controller when you come through 
your model, and it does no harm to be explicit. (I don't think that's your 
problem, though.)

You wrote:

Yet the URL continues to present at: http://brian.com/default/profile#_=_

Where's the '#_=_' coming from? That seems odd. And URL() doesn't generate the 
scheme and domain unless you explicitly tell it to. Are you looking at the page 
source?

 
 The profile function is defined in controllers/default.py
 
 On Sat, Jun 23, 2012 at 4:46 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 22, 2012, at 11:00 AM, Alec Taylor wrote:
 
 (just tried that, didn't work) - Looking forward to when you get the
 chance to pass it through unit-tests :)
 
 OK, I tried it and it seemed to work OK. Here's my test case:
 
router = dict(
   BASE = dict(
   default_application = 'init',
   applications = 'INIT',
   ),
   init = dict(
   controllers = ['default', 'ctr'],
   functions = ['index','user','register','basicRegister',
   'download','call','data','error']
   ),
)
 
 The applications= and controllers= lines are in there because of the unit 
 test environment; you don't need them as a rule.
 
 The test case:
 
self.assertEqual(str(URL(a='init', c='default', f='register')), 
 /register)
 
 How are you generating your URL? You have to use URL() to do it; that's 
 where the router gets invoked.
 
 --



--