registration error

3 views
Skip to first unread message

Lukasz Szybalski

unread,
Jun 5, 2008, 9:00:34 PM6/5/08
to tg-regi...@googlegroups.com
Hello,
I just created a new project with registration:
tg-admin quickstart -t 'turbogears registration'

then I was trying to do a next step and....


tg-admin shell
Python 2.5.2 (r252:60911, May 28 2008, 19:19:25)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(CustomShell)
>>> import myproject.registration.model as model
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named myproject.registration.model
>>> import pagg.registration.model as model
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/lucas/tmp/pagg/pagg/registration/model.py", line 41, in <module>
assign_mapper(session.context, RegistrationPendingUser,
registration_pending_user_table)
AttributeError: 'ScopedSession' object has no attribute 'context'


Is there a reason you guys still use assign_mapper? I though default
was 'mapper'

Thanks,
Lucas

Patrick Lewis

unread,
Jun 6, 2008, 12:12:32 AM6/6/08
to tg-registration

> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "/home/lucas/tmp/pagg/pagg/registration/model.py", line 41, in <module>
> assign_mapper(session.context, RegistrationPendingUser,
> registration_pending_user_table)
> AttributeError: 'ScopedSession' object has no attribute 'context'
>
> Is there a reason you guys still use assign_mapper? I though default
> was 'mapper'
>

It looks like you might be using an old version. Can you try

easy_install -U registration

and redoing the quickstart template insertion? The 0.4 release uses
mapper and not assign_mapper.

Lukasz Szybalski

unread,
Jun 6, 2008, 11:35:23 PM6/6/08
to tg-regi...@googlegroups.com


Thanks, I had to download it from the web.
easy_install will install version 0.1.x , I don't know if you need to
update something for it to get 0.4.

Also on your main website:
---------------------------------------------
"Add in the Registration Controller

In your main controllers.py, you need to reference the new
registration controller. If you want to expose registration off of the
root of your main controller, it would be something like:

from myproject.registration import controllers as reg_controllers

class Root(controller.RootController):
registration = reg_controllers.UserRegistration()
# the rest of your controller code
"
-----------

that should be
class Root(controllers.RootController) not class Root(controller.RootController)
missing an "s" at the end of controller

ok. so now I can register users., but
I need to make the user scheme look like the list below. What would I
have to look at/change to get setup like this:

1. group name = "1000"
A. user name =lucas
B. user name =john...etc...
2. group name: 1001
A. user name = kate
B. user name =anna...etc

Let me know.
Thanks.
Lucas

Patrick Lewis

unread,
Jun 7, 2008, 4:05:03 PM6/7/08
to tg-registration
On Jun 6, 11:35 pm, "Lukasz Szybalski" <szybal...@gmail.com> wrote:
>
> Thanks, I had to download it from the web.
> easy_install will install version 0.1.x , I don't know if you need to
> update something for it to get 0.4.

I can't reproduce this. I created a new virtualenv (with --no-site-
packages), and did:

$ easy_install registration
Searching for registration
Reading http://pypi.python.org/simple/registration/
Reading http://patrickhlewis.googlepages.com/registration.html
Reading http://pat.lewis.home.insightbb.com/
Best match: registration 0.4

It droned on and installed TG, but it found and installed the right
version. Are you saying

easy_install -U registration

didn't work either?

If you have time to look at it further, please try what I did (a new
virtualenv with --no-site-packages) and show the registration related
output.


>
> that should be
> class Root(controllers.RootController) not class Root(controller.RootController)
> missing an "s" at the end of controller

Thanks. fixed.

>
> ok. so now I can register users., but
> I need to make the user scheme look like the list below. What would I
> have to look at/change to get setup like this:
>
> 1. group name = "1000"
> A. user name =lucas
> B. user name =john...etc...
> 2. group name: 1001
> A. user name = kate
> B. user name =anna...etc
>

I think you want to add two groups (1000, 1001), and add the
appropriate users to those groups. I don't think anything needs to
change in your schema (or model). It's just adding data.

Lukasz Szybalski

unread,
Jun 7, 2008, 4:44:42 PM6/7/08
to tg-regi...@googlegroups.com
On Sat, Jun 7, 2008 at 3:05 PM, Patrick Lewis <patric...@gmail.com> wrote:
>
> On Jun 6, 11:35 pm, "Lukasz Szybalski" <szybal...@gmail.com> wrote:
>>
>> Thanks, I had to download it from the web.
>> easy_install will install version 0.1.x , I don't know if you need to
>> update something for it to get 0.4.
>
> I can't reproduce this. I created a new virtualenv (with --no-site-
> packages), and did:
>

It had to be some kind of glitch. It does get the 0.4 correctly today,
but yesterday it was getting 0.1. Maybe I was pointing to wrong
virtualenv...hmm?

Why do we need to create virtualenv with "with --no-site-packages"?


>>
>> ok. so now I can register users., but
>> I need to make the user scheme look like the list below. What would I
>> have to look at/change to get setup like this:
>>
>> 1. group name = "1000"
>> A. user name =lucas
>> B. user name =john...etc...
>> 2. group name: 1001
>> A. user name = kate
>> B. user name =anna...etc
>>
>
> I think you want to add two groups (1000, 1001), and add the
> appropriate users to those groups. I don't think anything needs to
> change in your schema (or model). It's just adding data.

Thanks,

Would it be possible to get below login flow based on the way
identity+registration are setup originally, if not what could I
change?

1.Enter your group number: 123 (maybe password if its possible, ?),
then enter username and password, or maybe even all three group,
username, pass?

2. I would like to delegate user creation to some person in group 123.
He/she would add send links to their users page group.

From screen http://localhost:8080/registration/new I don't see how one
controls the group you will belong to?
So is it possible for example :
http://localhost:8080/registration/123/new would register a person for
group 123, and the person I delegated to control group 123 would make
him/her active/ approved?

If this is done, could you tell me where I should look at, if not what
would have to be changed in identity or registration?

Thanks
Lucas

Patrick Lewis

unread,
Jun 8, 2008, 9:43:28 AM6/8/08
to tg-registration


On Jun 7, 4:44 pm, "Lukasz Szybalski" <szybal...@gmail.com> wrote:
> It had to be some kind of glitch. It does get the 0.4 correctly today,
> but yesterday it was getting 0.1. Maybe I was pointing to wrong
> virtualenv...hmm?
>
> Why do we need to create virtualenv with "with --no-site-packages"?
>

It ensures that you get a clean install from the central repository,
and not from local site-packages. I'm not sure, but I think if you do

easy_install registration

and had 0.2 installed locally, it would bring 0.2 over into your site-
packages into the virtual-env (again, this is a little bit of a
guess). But I know that --no-site-packages *wont* do that, and will go
to the web.

> Would it be possible to get below login flow based on the way
> identity+registration are setup originally, if not what could I
> change?
>
> 1.Enter your group number: 123 (maybe password if its possible, ?),
> then enter username and password, or maybe even all three group,
> username, pass?

I'm assuming you are talking about new user creation, and not normal
login. Take a look at

* widgets.NewUserFields (to modify the signup form)
* model.RegistrationPendingUser (to hold the new values)
* controllers.create (to save the proper data values given in the
form)

> 2. I would like to delegate user creation to some person in group 123.
> He/she would add send links to their users page group.
>
> From screenhttp://localhost:8080/registration/newI don't see how one
> controls the group you will belong to?
> So is it possible for example :http://localhost:8080/registration/123/newwould register a person for
> group 123, and the person I delegated to control group 123 would make
> him/her active/ approved?
>
> If this is done, could you tell me where I should look at, if not what
> would have to be changed in identity or registration?

The groups a user belongs to is defined in the registration config
variable:

registration.verified_user.groups

But all users are placed into those groups; you can't customize it by
user. If you want to change it, here's where to look:

* controllers.validate_new_user is called when the user clicks on the
registration email link.

* validate_new_user calls add_standard_groups, which does just that.

I imagine you want to interject somewhere before or after the email
validation, or perhaps you want to get rid of email validation
altogether (since someone is going to be looking at the data anyway).
There are really only two controllers here, create and
validate_new_user. You are going to have to insert your logic
somewhere in those two controllers.


Lukasz Szybalski

unread,
Jun 9, 2008, 2:15:03 PM6/9/08
to tg-regi...@googlegroups.com

Is registration supported on 2.4?

easy_install -U registration

Best match: registration 0.11
Downloading http://pypi.python.org/packages/2.4/r/registration/registration-0.11-py2.4.egg#md5=d918ae5e2d1d06037356c96c9ea899dc
Processing registration-0.11-py2.4.egg
creating /usr/local/pythonenv/BASELINE/lib/python2.4/site-packages/registration-0.11-py2.4.egg
Extracting registration-0.11-py2.4.egg to
/usr/local/pythonenv/BASELINE/lib/python2.4/site-packages
Adding registration 0.11 to easy-install.pth file

Installed /usr/local/pythonenv/BASELINE/lib/python2.4/site-packages/registration-0.11-py2.4.egg
Processing dependencies for registration
Finished processing dependencies for registration
(BASELINE)xxxxxx:/home/unique/turbogears/unis# date
Mon Jun 9 18:11:12 CDT 2008

Thanks,
Lucas

Lukasz Szybalski

unread,
Jun 9, 2008, 2:32:35 PM6/9/08
to tg-regi...@googlegroups.com

I downloaded it from your site and setup.py build, and install..
Could you put the new version on:
http://pypi.python.org/packages/2.4/r/registration/

I see it is on 2.5.
Lucas

Lukasz Szybalski

unread,
Jun 9, 2008, 8:40:47 PM6/9/08
to tg-regi...@googlegroups.com

Thanks for the info.

I got registration working in production with mod_wsgi, and everything
is setup and it works nice.
I read in cfg that
" Note that if you have TurboMail installed, these values will be ignored
# and TurboMail will be used to send email messages. TurboMail is
# strongly suggested for production applications, as the registration
# code is only single threaded will not exit certain controllers until
# the email is sent.
"
Does it mean I have to setup turbomail for it? Or what other settings
would turbomail require? I just east_install turbomail right now.


I decided to add users who are validated to 'pending' group, and then
I will designate somebody to move them to appropriate group.

Thanks,
Lucas

Patrick Lewis

unread,
Jun 11, 2008, 10:26:57 AM6/11/08
to tg-registration


On Jun 9, 8:40 pm, "Lukasz Szybalski" <szybal...@gmail.com> wrote:
>
> Thanks for the info.
>
> I got registration working in production with mod_wsgi, and everything
> is setup and it works nice.
> I read in cfg that
> " Note that if you have TurboMail installed, these values will be ignored
> # and TurboMail will be used to send email messages.  TurboMail is
> # strongly suggested for production applications, as the registration
> # code is only single threaded will not exit certain controllers until
> # the email is sent.
> "
> Does it mean I have to setup turbomail for it? Or what other settings
> would turbomail require? I just east_install turbomail right now.

Turbomail needs to be turned on and configured. You will need to refer
to the turbomail docs on how to do that (its pretty
straightforward).Once turbomail is configured, registration uses
turmbomail automatically to send email.
Reply all
Reply to author
Forward
0 new messages