Note, it is line 971, not 917. In the admin app, you can view the Python 
code of the compiled view in the error ticket.

Anthony

On Tuesday, December 20, 2016 at 6:31:37 PM UTC-5, Lisandro wrote:
>
> Thank you all for the help.
>
> @Anthony, sorry my ignorance, I was looking in the wrong place (looking in 
> the module, asuming the error was triggered there).
> Considering your answer and the traceback error, I say "ok, the error is 
> triggered from the view, in the line 917".
> But how do I know which is that line if the view is compiled?
> I've opened the compiled view with an editor, and went to the 917 line. I 
> don't know if that make sense, but in that line I've found a closing </div> 
> tag... :/
>
> Does it make any sense?
>
>
> @Dave, I can't use the logger here.
> The thing is that the app is actually installed several times (within the 
> same web2py installation), and each app instance is serving a website. 
> All the websites are running in production, and among all, they serve 
> around 150k visits per day. 
> So in order to try anything, I have to make the change, push it to the 
> repository, and update all the websites.
>
>
> The error is not a big deal. As you see, there is **a lot** of requests 
> per day, and the error appears every 3-4 days.
>
>
>
> El martes, 20 de diciembre de 2016, 16:40:47 (UTC-3), Anthony escribió:
>>
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to