consider the following snippets:
Model Code:
class User(object):
    """
    Reasonably basic User definition. Probably would want additional
    attributes.
    """
    def __init__(self, user_name, email_address, display_name, phone,
active, password):
        self.user_name = user_name
        self.email_address = email_address
        self.display_name = display_name
        self.password = identity.encrypt_password(password)

    def _set_password( self, cleartext_password ):
        self.password = identity.encrypt_password(cleartext_password)
        print  "encrypted", self.password

    def _get_password( self):
        return self.password

    passwd = property(_get_password, _set_password)



Test Code:

from turbogears import testutil, database, config
from model import *

config.update({'sqlalchemy.dburi':'sqlite:///:memory:',
               'visit.on': True,
               'identity.on': True,
               'identity.failure_url': '/login',
               'identity.provider':'sqlalchemy',
               'identity.saprovider.encryption_algorithm':'sha1',
           })
database.bind_meta_data()
database.metadata.drop_all()
database.metadata.create_all()
import unittest

class testUser(unittest.TestCase):
    def testGetPassword(self):
        user = User('user_name', '[EMAIL PROTECTED]', 'the user',
'asdf')
        print user.password
        session.save(user)
        session.flush()
        session.delete(user)
        session.flush()


OK, so when you print the password you should get some jibberish SHA
string, but instead you get a hearty 'asdf'

anyone?

-chris
www.percious.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to