Where is unicodedata.py located?
On Thursday, 11 October 2012 10:56:50 UTC-5, Adi wrote:
>
>
> unicodedata module is accessible in a view when i test code directly from
> an application, but get the error when run the same code from scheduler. I
> can move the code up to a model (db_scheduler), but just wanted to know if
> imports from models should be visible to Views when run through scheduler?
>
> Thanks,
> Adnan
>
>
> db_scheduler.py
> import unicodedata
>
> def send_order_confirmation_email():
> ...
> context=dict(order=order)
> message=response.render(msg_file, context)
> ...send email
> return
>
> Views:
> msg_file.html
> {{=XML('<p>%s %s</p>' % \
> (row.orderItem.Qty,unicodedata
> .normalize('NFKD', \
> unicode(row.
> orderItemDetail.ProductDesc, 'utf8')).encode('ascii','ignore')))
> }}
>
>
>
> Traceback (most recent call last):
> File "/opt/web-apps/web2py/gluon/scheduler.py", line 218, in executor
> result = dumps(_function(*args,**vars))
> File "applications/crm/models/db_scheduler.py", line 179, in
> send_order_confirmation_email
> message=response.render(msg_file, context)
> File "/opt/web-apps/web2py/gluon/globals.py", line 217, in render
> run_view_in(self._view_environment)
> File "/opt/web-apps/web2py/gluon/compileapp.py", line 654, in run_view_in
> context=environment)
> File "/opt/web-apps/web2py/gluon/restricted.py", line 222, in restricted
> raise RestrictedError(layer, code, output, environment)
> RestrictedError: <type 'exceptions.NameError'> name 'unicodedata' is not
> defined
>
>
>
--