Ignore:
Timestamp:
Jul 2, 2010 1:46:49 PM (14 years ago)
Author:
mylan
Message:

Register IGAuthUtility to LocalSiteManager? on installation and bound to configlet; some refactoring and updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.gauth/trunk/quintagroup/gauth/utility.py

    r2608 r2609  
    88from plone.memoize.view import memoize_contextless 
    99 
    10 from quintagroup.gauth.interfaces import IGAuthInterface 
     10from quintagroup.gauth.interfaces import IGAuthUtility 
    1111from quintagroup.gauth.browser.configlet import IGAuthConfigletSchema 
    1212 
     
    2020 
    2121class GAuthUtility(object): 
    22     implements(IGAuthInterface) 
     22    implements(IGAuthUtility) 
    2323 
    2424    gconf = None 
    25  
    26     def gconf_init(self, context, request): 
    27         pps = queryMultiAdapter((context, request), name="plone_portal_state") 
     25     
     26    def __init__(self, context): 
     27        # Bind utility to the context 
     28        pps = queryMultiAdapter((context, context.REQUEST), name="plone_portal_state") 
    2829        self.gconf = queryAdapter(pps.portal(), IGAuthConfigletSchema) 
    2930 
     
    3132    def email(self): 
    3233        """ Get the email.""" 
    33         if not self.gconf: 
    34             return None 
    35         return self.gconf.gauth_email 
     34        return getattr(self.gconf, 'gauth_email', '') 
    3635 
    3736    @property 
    3837    def password(self): 
    3938        """ Get the password.""" 
    40         if not self.gconf: 
    41             return None 
    42         return self.gconf.gauth_pass 
     39        return getattr(self.gconf, 'gauth_pass', '') 
    4340 
    4441 
     
    5552 
    5653            def __init__(self): 
    57                 gauth_util = queryUtility(IGAuthInterface) 
     54                gauth_util = queryUtility(IGAuthUtility) 
    5855                self.service = gdata.spreadsheet.service.SpreadsheetService( 
    5956                                   gauth_util.email, gauth_util.password) 
Note: See TracChangeset for help on using the changeset viewer.