validate_new_user method error

2 views
Skip to first unread message

.M.

unread,
Oct 3, 2008, 2:54:15 AM10/3/08
to tg-registration
Hi

I'm stuck with this error on the /registration/validate_new_user
method.

Any advice? I've tried this on 0.4 and 0.5 and created a new project
specifically to see if I've done something by mistake with the
boilerplate Identity code.


Page handler: <bound method UserRegistration.validate_new_user of
<help4me.registration.controllers.UserRegistration object at
0x897012c>>
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/CherryPy-2.3.0-py2.4.egg/
cherrypy/_cphttptools.py", line 121, in _run
self.main()
File "/usr/lib/python2.4/site-packages/CherryPy-2.3.0-py2.4.egg/
cherrypy/_cphttptools.py", line 264, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in validate_new_user
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/
turbogears/controllers.py", line 363, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/
turbogears/database.py", line 405, in sa_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/
turbogears/controllers.py", line 380, in <lambda>
mapping, fragment, args, kw)))
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/
turbogears/controllers.py", line 408, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/
turbogears/errorhandling.py", line 72, in try_call
return func(self, *args, **kw)
File "/home/michela/src/repos/help4me/help4me/registration/
controllers.py", line 124, in validate_new_user
new_user = self.promote_pending_user(pend)
File "/home/michela/src/repos/help4me/help4me/registration/
controllers.py", line 149, in promote_pending_user
columns = pending_user.c.keys() # list of column names
AttributeError: 'RegistrationPendingUser' object has no attribute 'c'


Best
.M.

Patrick Lewis

unread,
Oct 3, 2008, 7:17:23 AM10/3/08
to tg-registration
A couple questions:
1) Paste your code from promote_pending_user method into http://paste.turbogears.org/
and give us the link.
2) Are you using SQLAlchemy or SQLObject?

The code that is failing is trying to find the columns/properties that
a RegistrationPendingUser has and copy them to the new User, but that
isn't working for whatever reason.

.M.

unread,
Oct 6, 2008, 7:06:39 PM10/6/08
to tg-registration

Here's my promote_pending_user_method

http://paste.turbogears.org/paste/9481

Using SQLAlchemy

These are the commands I'm using to quickstart project

tg-admin quickstart -t tggenshi --sqlalchemy
tg-admin update -t 'turbogears registration'

Thanks in advance

Cheers
.M.

On Oct 3, 10:17 pm, Patrick Lewis <patrickhle...@gmail.com> wrote:
> A couple questions:
> 1) Paste your code from promote_pending_user method intohttp://paste.turbogears.org/

Patrick Lewis

unread,
Oct 7, 2008, 9:10:31 AM10/7/08
to tg-registration
On Oct 6, 7:06 pm, ".M." <modfi...@gmail.com> wrote:
> Here's my promote_pending_user_method
>
> http://paste.turbogears.org/paste/9481
>
> Using SQLAlchemy
>
> These are the commands I'm using to quickstart project
>
> tg-admin quickstart -t tggenshi --sqlalchemy
> tg-admin update -t 'turbogears registration'
>

Looks like the .c attribute was removed in the 0.5 release of
SqlAlchemy (I'm assuming you're using 0.5). Try this (untested):

# in imports section
from sqlalchemy.orm import class_mapper

And then something like:
http://paste.turbogears.org/paste/9494

If that doesn't work, you can always assign each field manually. e.g.

new_user = register_model.User()
new_user.user_name = pending_user.user_name
new_user.email = pending_user.email
...

.M.

unread,
Oct 8, 2008, 8:33:05 AM10/8/08
to tg-registration
Partly works, doesn't transfer all fields but does some.

Thanks. I'll post you a patch when I get it working.

Cheers
.M.

.M.

unread,
Oct 9, 2008, 7:23:09 AM10/9/08
to tg-registration
I'm stumped Patrick.

Your code didn't transfer user_name and I couldn't work out how to use
the Column object so i went with option two.
Reply all
Reply to author
Forward
0 new messages