Changeset 2063

Show
Ignore:
Timestamp:
02/28/07 15:07:51 (2 years ago)
Author:
mgood
Message:

AccountManagerPlugin:

make the filename option display nicely in admin page (fixes #903)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • accountmanagerplugin/0.10/acct_mgr/htfile.py

    r1844 r2063  
    4242 
    4343 
     44class _RelativePathOption(Option): 
     45  
     46    def __get__(self, instance, owner): 
     47        if instance is None: 
     48            return self 
     49        path = super(_RelativePathOption, self).__get__(instance, owner) 
     50        return os.path.normpath(os.path.join(instance.env.path, path)) 
     51 
     52 
    4453class AbstractPasswordFileStore(Component): 
    4554    """Base class for managing password files such as Apache's htpasswd and 
     
    4958    """ 
    5059 
    51     _filename = Option('account-manager', 'password_file') 
    52  
    53     def filename(self): 
    54         return os.path.normpath(os.path.join(self.env.path, self._filename)) 
    55     filename = property(filename) 
     60    filename = _RelativePathOption('account-manager', 'password_file') 
    5661 
    5762    def has_user(self, user): 
  • accountmanagerplugin/trunk/acct_mgr/htfile.py

    r1844 r2063  
    4242 
    4343 
     44class _RelativePathOption(Option): 
     45  
     46    def __get__(self, instance, owner): 
     47        if instance is None: 
     48            return self 
     49        path = super(_RelativePathOption, self).__get__(instance, owner) 
     50        return os.path.normpath(os.path.join(instance.env.path, path)) 
     51 
     52 
    4453class AbstractPasswordFileStore(Component): 
    4554    """Base class for managing password files such as Apache's htpasswd and 
     
    4958    """ 
    5059 
    51     _filename = Option('account-manager', 'password_file') 
    52  
    53     def filename(self): 
    54         return os.path.normpath(os.path.join(self.env.path, self._filename)) 
    55     filename = property(filename) 
     60    filename = _RelativePathOption('account-manager', 'password_file') 
    5661 
    5762    def has_user(self, user):