Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #939 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

soprovider won't work without web context

Reported by: anonymous Owned by: anonymous
Priority: normal Milestone:
Component: Identity Version: 0.9a6
Severity: normal Keywords:
Cc:

Description

contrary to what the wiki suggests [1] it is not possible to create new users programmaticly. I'd like to do this to be able to have quickstart functionality for my application: run a script at installation time that adds some predefined groups to the database, asks for a username and password for the initial user and create that as well.

I've hacked around this problem by adding an exception to the except block in turbogears.identity.soprovider.TG_User._set_password. The start of this function was:

    def _set_password( self, cleartext_password ):
        "Runs cleartext_password through the hash algorithm before saving."
        try:
            hash = identity.current_provider.encrypt_password(cleartext_password)
        except identity.exceptions.IdentityManagementNotEnabledException:
             ...

I've changed this to:

    def _set_password( self, cleartext_password ):
        "Runs cleartext_password through the hash algorithm before saving."
        try:
            hash = identity.current_provider.encrypt_password(cleartext_password)
        except (identity.exceptions.IdentityManagementNotEnabledException, identity.exceptions.RequestRequiredException):
             ...

This seems to be in the spirit of the intentions of that except block.

[1] http://trac.turbogears.org/turbogears/wiki/IdentityManagement

Change History

comment:1 Changed 13 years ago by bjourne

The suggested change in this ticket fixed the problem for me.

comment:2 Changed 13 years ago by jorge.vargas

  • Status changed from new to closed
  • Resolution set to fixed

I believe r1667 fixed this.

Note: See TracTickets for help on using tickets.