Opened 14 years ago

Closed 14 years ago

#14689 closed (invalid)

AUTH_USER_PROFILE setting not parsed correctly.

Reported by: twoolie Owned by: nobody
Component: Contrib apps Version: 1.2
Severity: Keywords: AUTH_USER_PROFILE
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

currently the behavior of AUTH_USER_PROFILE does not allow for imported profiles from a packaged distribution.
e.g. i have downloaded sphene community tools and i wish to set AUTH_PROFILE_MODULE = 'sphene.community.CommunityUserProfile'

The current code at <contrib/auth/models.py@357>

    try:
        app_label, model_name = settings.AUTH_PROFILE_MODULE.split('.')
    except ValueError:
        raise SiteProfileNotAvailable('app_label and model_name should'
                ' be separated by a dot in the AUTH_PROFILE_MODULE set'
                'ting')

this does not take into account that app_label can itself be dot-delimited.

I propose the following patch.

    try:
        path = settings.AUTH_PROFILE_MODULE.split('.')
        app_label = ".".join(path[0:-1])
        model_name = path[-1]
    except ValueError:
        raise SiteProfileNotAvailable('app_label and model_name should'
                ' be separated by a dot in the AUTH_PROFILE_MODULE set'
                'ting')

Change History (1)

comment:1 by twoolie, 14 years ago

Resolution: invalid
Status: newclosed

Nevermind, i figured out why this behavior is ok.

Note: See TracTickets for help on using tickets.
Back to Top