source: products/quintagroup.gauth/trunk/quintagroup/gauth/utility.py @ 2603

Last change on this file since 2603 was 2603, checked in by mylan, 14 years ago

Added GAuth utility and appropriate interface

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1"""
2    Provide utility for getting GData portal account email and password.
3"""
4
5from zope.interface import implements
6from zope.component import queryMultiAdapter, queryAdapter
7from plone.memoize.view import memoize_contextless
8
9from quintagroiup.gauth.interfaces import IGAuthInterface
10from quintagroup.gdata.browser.configlet import IGDataConfigletSchema
11
12
13class GAuthUtility(object):
14    implements(IGAuthInterface)
15
16    def __init__(self, context):
17        self.context = context
18
19    @property
20    @memoize_contextless
21    def gdataconf(self):
22        pps = queryMultiAdapter((self.context, self.context.REQUEST), name="plone_portal_state")
23        return queryAdapter(pps.portal(), IGDataConfigletSchema)
24
25    @property
26    def email(self):
27        """ Get the email."""
28        return self.gdataconf.gdata_email
29
30    @property
31    def password(self):
32        """ Get the password."""
33        return self.gdataconf.gdata_pass
34
35
36    # @property
37    # @memoize_contextless
38    # def portal(self):
39    #     pps = queryMultiAdapter((self.context, self.context.REQUEST), name="plone_portal_state")
40    #     return pps.portal()
Note: See TracBrowser for help on using the repository browser.