return LOAD('plugin_comments','comments.load',args=[tablename, record_id,
page],ajax=True)
File
"/home/martin/Repositorios/google_appengine/web2py/gluon/compileapp.py",
line 145, in __call__
extension=extension)
File "/home/martin/Repositorios/google_appengine/web2py/gluon/html.py",
line 262, in URL
acf = rewrite.map_url_out(application, controller, function, args, r or
_request)
File "/home/martin/Repositorios/google_appengine/web2py/gluon/rewrite.py",
line 867, in map_url_out
map = MapUrlOut(application, controller, function, args, request)
File "/home/martin/Repositorios/google_appengine/web2py/gluon/rewrite.py",
line 722, in __init__
self.domain_application = self.request.env.domain_application
AttributeError: 'NoneType' object has no attribute 'env'
I start to test, but I have this error In GAE
2011/1/17 Jonathan Lundell <[email protected]>
> On Jan 16, 2011, at 5:44 PM, Matt wrote:
> >
> > Hi Jonathan,
> >
> > Thanks for your quick response. Yes the application is 'app'.
> >
> > Sure, that would be great.
>
> I've been looking at this, and a couple of things aren't making sense to
> me. Your configuration sounds fine, at least what I see of it. I've been
> testing it like this:
>
> routers = dict(
> BASE = dict(
> default_application = 'app',
> ),
> app = dict(
> controllers = ['default', 'error', 'appadmin'],
> ),
> )
>
> routes_onerror = [(r'*/*', r'/error')]
>
> ...because I don't have an application installed named 'app'; this tells
> the router logic to pretend there's such an app, with the indicated
> controllers (if the controller list is different, please let me know, but it
> shouldn't much affect things).
>
> You wrote that this works:
>
> http://localhost:8000/css/base.css
>
> ...but it really shouldn't, since there's no way for the router to
> recognize the URL as a static file. I'd expect it to be rewritten as:
>
> http://localhost:8000/app/css/base.css
>
> ...that is, treating 'css' as a controller. I would expect this to work:
>
> http://localhost:8000/static/css/base.css
>
> So I'm wondering first if you're running the current trunk (last few days,
> anyway). If not, the 'routers=' entry will be ignored.
>
> Second, it would be helpful to turn on router logging. To do so, copy
> logging.example.conf to logging.conf, and then edit the rewrite logger and
> console handler to log debug messages:
>
> [logger_rewrite]
> level=DEBUG
> qualname=web2py.rewrite
> handlers=consoleHandler
> propagate=0
>
> ...
>
> [handler_consoleHandler]
> class=StreamHandler
> level=DEBUG
> formatter=simpleFormatter
> args=(sys.stdout,)
>
> (If you're not able to log to the console, you'll have to do more
> configuration work to log elsewhere.)
>
> Another thing to try, and I recommend this for anyone doing routing, is to
> customize the doctest in routes.py for your own routing policy. Try
> replacing the existing doctest with this (if this doesn't work, please send
> me your routes.py privately and I'll edit it myself and send it back). You
> run the doctest at the cli:
>
> python routes.py
>
>
>
> >>> import os
> >>> import gluon.main
> >>> from gluon.rewrite import load, filter_url, filter_err,
> get_effective_router, try_redirect_on_error
> >>> load(routes=os.path.basename(__file__))
>
> >>> filter_url('http://localhost:8000/css/base.css', router='app')
> 'app'
> >>> os.path.relpath(filter_url('http://domain.com/favicon.ico'))
> 'applications/app/static/favicon.ico'
> >>> filter_url('http://domain.com/abc')
> '/app/default/abc'
> >>> filter_url('http://localhost:8000/css/base.css')
> "/app/default/css ['base.css']"
> >>> os.path.relpath(filter_url('http://domain.com/static/css/base.css'
> ))
> 'applications/app/static/css/base.css'
>
> >>> from gluon.http import HTTP
> >>> from gluon.storage import Storage
> >>> http = HTTP(400, 'original http message', Location='some/location')
> >>> request = Storage()
> >>> request.env = Storage()
> >>> request.application = 'app'
> >>> request.env.request_uri = 'request_uri'
> >>> request.url = 'request.url'
> >>> http = try_redirect_on_error(http, request)
> >>> (http.status, http.body, http.headers.get('Location'))
> (303, 'You are being redirected <a
> href="/error?code=400&ticket=None&requested_uri=request_uri&request_url=request.url">here</a>',
> '/error?code=400&ticket=None&requested_uri=request_uri&request_url=request.url')
>
> >>> filter_url('https://domain.com/app/ctr/fcn', out=True)
> '/ctr/fcn'
> >>> filter_url('https://domain.com/welcome/ctr/fcn', out=True)
> '/welcome/ctr/fcn'
> >>> filter_url('https://domain.com/app/default/fcn', out=True)
> '/fcn'
> >>> filter_url('https://domain.com/app/default/index', out=True)
> '/'
> >>> filter_url('https://domain.com/app/appadmin/index', out=True)
> '/appadmin'
> >>> filter_url('http://domain.com/app/default/fcn?query', out=True)
> '/fcn?query'
> >>> filter_url('http://domain.com/app/default/fcn#anchor', out=True)
> '/fcn#anchor'
> >>> filter_url('http://domain.com/app/default/fcn?query#anchor',
> out=True)
> '/fcn?query#anchor'
>
> >>> filter_err(200)
> 200
> >>> filter_err(399)
> 399
> >>> filter_err(404)
> '/error?code=404&ticket=tkt'
>
>
>
>
>
>
> >
> > Cheers,
> > Matt
> >
> >
> > On Jan 17, 2:19 pm, Jonathan Lundell <[email protected]> wrote:
> >> Thanks for the report, Matt.
> >>
> >> On Jan 16, 2011, at 5:11 PM, Matt wrote:
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>> Hi Jonathan,
> >>
> >>> I'm also trying to use the new routing approach and I'm having a
> >>> little trouble with static files.
> >>
> >>> In my app's static directory I have sub folders (containing files)
> >>> like this:
> >>
> >>> /static/css/base.css
> >>> /static/images/logo.png
> >>> /static/js/jquery.js
> >>
> >>> I'm using the most minimal routing:
> >>
> >>> routers = dict(
> >>> BASE = dict(
> >>> default_application = 'app',
> >>> ),
> >>> )
> >>
> >>> routes_onerror = [(r'*/*', r'/error')]
> >>
> >>> Now when I try and request certain files I seem to get very unexpected
> >>> results....
> >>
> >>> When I try:
> >>
> >>> http://localhost:8000/css/base.css
> >>
> >>> it works.
> >>
> >> OK, I wouldn't expect that to work.
> >>
> >> Your app name is 'app', right?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>> however when I request an invalid link like:
> >>
> >>> http://localhost:8000/css/base2.css
> >>
> >>> It doesn't raise a 404 as I'd expect.
> >>
> >>> Also for some reason I can't seem to use:
> >>
> >>> http://localhost:8000/static/css/base.css(gives a 403 error and
> >>> doesn't redirect to error).
> >>
> >>> But I have to use 'static' for javascript files:
> >>
> >>> http://localhost:8000/static/js/jquery.js
> >>
> >>> As
> >>
> >>> http://localhost:8000/js/jquery.js gives an error and redirects to :
> >>
> >>> http://localhost:8000/error?code=400&ticket=None&requested_uri=/js/jq.
> ..
> >>
> >>> Any suggestions?
> >>
> >> I'll investigate, using your parameters. Can't promise to get to it
> tonight, though.
>
>
>
--
Pablo Martín Mulone ([email protected])
http://www.tecnodoc.com.ar/
Paraná, Entre Ríos, Argentina (CP 3100).
My blog: http://martin.tecnodoc.com.ar
Expert4Solution Profile:
http://www.experts4solutions.com/e4s/default/expert/6