Problem with h.secure_form after upgrade to pylons 1.0

15 views
Skip to first unread message

Low Kian Seong

unread,
Jul 14, 2010, 7:01:32 AM7/14/10
to pylons-discuss
Dear all,

After an upgrade to Pylons 1.0 I have been having this problem loading
up my site. It gives me this error which I cannot make head or tail
out of :

response = self._inspect_call(func)
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Pylons-1.0-py2.6.egg/pylons/controllers/core.py', line 105 in
_inspect_call
result = self._perform_call(func, args)
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Pylons-1.0-py2.6.egg/pylons/controllers/core.py', line 57 in
_perform_call
return func(**args)
File '<string>', line 2 in login
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Pylons-1.0-py2.6.egg/pylons/decorators/rest.py', line 33 in
check_methods
return func(*args, **kwargs)
File '<string>', line 2 in login
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Pylons-1.0-py2.6.egg/pylons/decorators/rest.py', line 67 in dispatcher
return func(self, *args, **kwargs)
File '/home/lowks/COT_TRUNK_ROOT/nilacl/nilacl/controllers/auth.py',
line 32 in login
return render('/auth/login.mako')
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Pylons-1.0-py2.6.egg/pylons/templating.py', line 243 in render_mako
cache_type=cache_type, cache_expire=cache_expire)
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Pylons-1.0-py2.6.egg/pylons/templating.py', line 218 in
cached_template
return render_func()
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Pylons-1.0-py2.6.egg/pylons/templating.py', line 240 in
render_template
return literal(template.render_unicode(**globs))
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/template.py', line 198 in render_unicode
as_unicode=True)
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/runtime.py', line 403 in _render
_render_context(template, callable_, context, *args,
**_kwargs_for_callable(callable_, data))
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/runtime.py', line 434 in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/runtime.py', line 457 in _exec_template
callable_(context, *args, **kwargs)
File '/home/lowks/COT_TRUNK_ROOT/nilacl/data/templates/base.mako.py',
line 98 in render_body
__M_writer(escape(next.body()))
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/runtime.py', line 278 in <lambda>
return lambda *args, **kwargs:callable_(self.context, *args,
**kwargs)
File '/home/lowks/COT_TRUNK_ROOT/nilacl/data/templates/auth/
login.mako.py', line 36 in render_body
runtime._include_file(context, u'form.mako', _template_uri,
login_extra=self.login_extra)
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/runtime.py', line 341 in _include_file
callable_(ctx, **_kwargs_for_include(callable_, context._orig,
**kwargs))
File '/home/lowks/COT_TRUNK_ROOT/nilacl/data/templates/auth/
form.mako.py', line 79 in render_body
__M_writer(escape(login_extra()))
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/runtime.py', line 278 in <lambda>
return lambda *args, **kwargs:callable_(self.context, *args,
**kwargs)
File '/home/lowks/COT_TRUNK_ROOT/nilacl/data/templates/auth/
login.mako.py', line 73 in render_login_extra
runtime._include_file(context, u'/email/form.mako', _template_uri)
File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
Mako-0.3.4-py2.6.egg/mako/runtime.py', line 341 in _include_file
callable_(ctx, **_kwargs_for_include(callable_, context._orig,
**kwargs))
File '/home/lowks/COT_TRUNK_ROOT/nilacl/data/templates/email/
form.mako.py', line 44 in render_body
__M_writer(escape(h.secure_form(h.url_for('forgot_password'),
method='post')))
TypeError: 'module' object is not callable


Can someone please shed some light ? Thank you.

Mike Orr

unread,
Jul 14, 2010, 6:57:29 PM7/14/10
to pylons-...@googlegroups.com
On Wed, Jul 14, 2010 at 4:01 AM, Low Kian Seong <plon...@gmail.com> wrote:
> Dear all,
>
> After an upgrade to Pylons 1.0 I have been having this problem loading
> up my site. It gives me this error which I cannot make head or tail
> out of :
>
>  response = self._inspect_call(func)
> File '/home/lowks/virtualenv/cot/lib/python2.6/site-packages/
> Mako-0.3.4-py2.6.egg/mako/runtime.py', line 341 in _include_file
>  callable_(ctx, **_kwargs_for_include(callable_, context._orig,
> **kwargs))
> File '/home/lowks/COT_TRUNK_ROOT/nilacl/data/templates/email/
> form.mako.py', line 44 in render_body
>  __M_writer(escape(h.secure_form(h.url_for('forgot_password'),
> method='post')))
> TypeError: 'module' object is not callable
>
>
> Can someone please shed some light ? Thank you.

Hi, I'm the WebHelpers maintainer but I don't know much about
secure_form, which was written before my time. It did move from
'webhelpers.html' to 'webhelpers.pylonslib' in 1.0, to show that it
depends on Pylons.

The error looks like your import is wrong in helpers.py . You're
importing the secure_form module, not the secure_form function inside
it. The correct import for 'h.secure_form()' is:

from webhelpers.pylons.secure_form import secure_form

Or

from webhelpers.pylons.secure_form import *

Although the latter may import more than you want.

--
Mike Orr <slugg...@gmail.com>

Low Kian Seong

unread,
Jul 14, 2010, 9:39:33 PM7/14/10
to pylons-discuss


On Jul 15, 6:57 am, Mike Orr <sluggos...@gmail.com> wrote:
You are right the location of secure_form is different. If I do those
that you suggested, I end up with this error :

(cot)lowks@lowkster-desktop:~/COT_TRUNK_ROOT$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from webhelpers.pylons.secure_form import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pylons.secure_form


>
> Although the latter may import more than you want.
>
> --
> Mike Orr <sluggos...@gmail.com>

Low Kian Seong

unread,
Jul 14, 2010, 9:58:08 PM7/14/10
to pylons-discuss


On Jul 15, 6:57 am, Mike Orr <sluggos...@gmail.com> wrote:
Okay. Found the proper line of import:

from webhelpers.pylonslib.secure_form import secure_form

That solved my problem.
>
> --
> Mike Orr <sluggos...@gmail.com>
Reply all
Reply to author
Forward
0 new messages