On 5/10/06, Cox Chen <[EMAIL PROTECTED]> wrote:

I'm using TG 0.9a5 and have the same "by_user_name" error (before).
After reviewing the change of "identity/soprovider.py" from TG 0.9a4 to
TG 0.9a5,

yes your right it was in 9a5 i wasnt  sure about that

I found that, in the "TG_User" class of TG 0.9a5,
the "user_name" have an additional parameter:
alternateMethodName="by_user_name".

yes this is because that's the only way of making them PEP8 compliant, which is UGLY as hell

And this may be the cause of "by_user_name" error.
So I did the following modification to the model.py of FastTrack 0.5,
and it works.

so basically you copy over the code from the TG_* classes in the core package?

sorry i cant help more but i'm not familiar with the module

class Person(SQLObject):
    displayName     = StringCol(length=255, alternateID=True)
    user_name       = StringCol(length=16, alternateID=True,
                                alternateMethodName="by_user_name")
    password        = StringCol()
    emailAddress    = StringCol(length=255, alternateID=True,
                                alternateMethodName="by_email_address")

    groups = RelatedJoin("Groups", intermediateTable="tg_user_group",
                         joinColumn="user_name",
otherColumn="group_name")

    def _get_permissions( self ):
        perms = set()
        for g in self.groups:
            perms = perms | set( g.permissions)
        return perms

class Groups(SQLObject):
    group_name  = StringCol(length=16, alternateID=True,
                            alternateMethodName="by_group_name")
    displayName = StringCol(length=255)
    created     = DateTimeCol(default=datetime.now)

    # collection of all users belonging to this group
    users       = RelatedJoin("Person",
                              intermediateTable="tg_user_group",
                              joinColumn="group_name",
                              otherColumn="user_name")

    # collection of all permissions for this group
    permissions = RelatedJoin("Permission",
                              joinColumn="group_name",
                              intermediateTable="tg_group_permission",
                              otherColumn="permission_name")

class Permission(SQLObject):
    permission_name = StringCol(length=16, alternateID=True,

alternateMethodName="by_permission_name")
    description     = StringCol(length=255)
    groups          = RelatedJoin("Groups",

intermediateTable="tg_group_permission",
                                  joinColumn="permission_name",
                                  otherColumn="group_name")


I hope this can help.

- Cox Chen




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to