The traceback refers to line 971 in the compiled view (not in a module), indicating a call to the URL() function on that line.
On Tuesday, December 20, 2016 at 1:33:18 PM UTC-5, Lisandro wrote: > > Thanks for the quick answer. > Yes, I have automated my app with a function; it sets the app in > mantainance mode (message for the public), updates the code from > repository, compiles the app, restarts uwsgi, and turns off mantainance > mode. > Just in case, I've just checked and it is running compiled. > > > Line 917 is the call to get_url() function. > That line is not in the compiled view, but within a module. > The view just renders my pagination object, so it just does > {{=pagination.html()}} > The pagination object is defined within a module, and the line 917 is the > one calling to get_url(). > > This is a resume of my Pagination object: > > class Pagination(object): > def __init__(self, cpp, total, pagina, arg_index=0): > # ... initializations > > def get_url(self, page): > request = current.request > args = request.args or [] > while len(args) < (self.arg_index + 1): > args.append(None) > args[self.arg_index] = page > try: > return URL(args=args, vars=request.vars) > except: > return URL(args=args) > > def html(self): > result = '' > for e in range(1, self.paginas + 1): > result += '<a href="%s">%s</a>' % (self.get_url(e), e) > return XML(result) > > > > The thing is t hat I've hit the URL with any probable combination of args > and vars, but I cannot reproduce the error. > > Does the ticket store info about the content of vars and args when the > error triggered? > I'm sending tickets2email, so I don't conserve the original ticket, but If > I could find that info in the ticket, I guess I could disable tickets2email > in scheduler and wait for the error to appear again. > > > > > El martes, 20 de diciembre de 2016, 11:37:44 (UTC-3), Anthony escribió: >> >> Which line is 971? Are you sure you re-compiled the app after making the >> code change? >> >> On Tuesday, December 20, 2016 at 6:38:07 AM UTC-5, Lisandro wrote: >>> >>> Hi there! >>> I have a web2py application running, it's been running for a long time, >>> it is a website that serves hundreds of thousands of visits per day, and >>> everything works really good. >>> However, everyonce in a while (let's say, every 3-4 days) an error >>> ticket is generated with this traceback: >>> >>> Traceback (most recent call last): >>> File "/var/www/medios/gluon/restricted.py", line 227, in restricted >>> exec ccode in environment >>> File "applications/website/compiled/views.lista.html.py", line 971, >>> in File "/var/www/medios/gluon/html.py", line 387, in URL other += >>> '?%s' % urllib.urlencode(list_vars) >>> File "/usr/lib/python2.7/urllib.py", line 1332, in urlencode v = >>> quote_plus(str(v)) >>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in >>> position 5: ordinal not in range(128) >>> >>> >>> The code portion of my "compiled/views.lista.html.py" involved in the >>> error is the call to this function get_url(page), used to create a >>> paginator in the view: >>> >>> def get_url(page, arg_index): >>> args = request.args or [] >>> if len(args) < (arg_index + 1): >>> args.append(None) >>> args[arg_index] = pagina >>> try: >>> return URL(args=args, vars=request.vars) >>> except: >>> return URL(args=args) >>> >>> >>> As you see, I put a try: except block there, because I thought maybe the >>> request.vars had something to do with it. >>> But the error keeps triggering every 3-4 days, and I don't know how to >>> debug it, or where to start. >>> Of course, I've hit the application with every possible combination of >>> request.vars and request.args, but I can't trigger the error. >>> >>> Can I do anything else to avoid the error? >>> Thanks in advance! >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.