Changeset 3282 in products for quintagroup.portlet.static/trunk/quintagroup/portlet/static/staticstylishportlet.py
- Timestamp:
- Sep 26, 2011 1:56:13 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.portlet.static/trunk/quintagroup/portlet/static/staticstylishportlet.py
r2776 r3282 9 9 from zope.formlib import form 10 10 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile 11 from Products.CMFCore.utils import getToolByName 12 from Acquisition import aq_inner 11 13 12 14 from quintagroup.portlet.static.utils import getVocabulary … … 21 23 same. 22 24 """ 25 26 anonymous_only = schema.Bool( 27 title=_(u"Anonymous only"), 28 description=_(u"Check this to hide the portlet for logged-in users."), 29 required=False, 30 default=False, 31 ) 23 32 24 33 styling = schema.Choice(title=_(u"Portlet style"), … … 40 49 41 50 styling = '' 42 51 52 anonymous_only = False 53 43 54 def __init__(self, header=u"", text=u"", omit_border=False, footer=u"", 44 more_url='', hide=False, styling='' ):55 more_url='', hide=False, styling='', anonymous_only=False): 45 56 super(Assignment, self).__init__(header=header, text=text, omit_border=omit_border, footer=footer, 46 57 more_url=more_url) 47 58 48 59 self.styling = styling 49 60 self.anonymous_only = anonymous_only 61 50 62 class Renderer(static.Renderer): 51 63 """Portlet renderer. … … 57 69 58 70 render = ViewPageTemplateFile('staticstylishportlet.pt') 71 72 @property 73 def available(self): 74 if self.data.anonymous_only: 75 context = aq_inner(self.context) 76 mtool = getToolByName(context, 'portal_membership') 77 return mtool.isAnonymousUser() 78 79 return True 59 80 60 81
Note: See TracChangeset
for help on using the changeset viewer.