コード例 #1
0
ファイル: practice.py プロジェクト: Siyavula/emas.theme
 def add_first_login_message(self, member):
     last_login_time = member.getProperty('last_login_time')
     login_time = member.getProperty('login_time')
     # if it last login and current login are within 2 seconds of eachother, 
     # we consider this the 'first login'
     if login_time.micros() - last_login_time.micros() < 2000000:
         plone_utils = getToolByName(self.context, 'plone_utils')
         message = _(u'Have a look at the practice services.')
         plone_utils.addPortalMessage(message, 'info')
コード例 #2
0
    def test_noaccess_message(self):
        plone_utils = getToolByName(self.portal, 'plone_utils')
        message = _(u'You do not currently have access to this service.')
        plone_utils.addPortalMessage(message, 'services-warning')
        
        viewlet = self.get_viewlet()
        result = viewlet.index()

        expected_result = \
u"""\n\n    <dl id="practice-service-messages" class="portalMessage services-warning">\n        <dd>You do not currently have access to this service.</dd>\n    </dl>\n\n\n"""
        self.assertEqual(result, expected_result, 'Incorrect message returned.')

        doc = lxml.html.fromstring(result)
        self.assertEqual(len(doc.xpath('//dl')), 1, 'No content found.')
コード例 #3
0
ファイル: userdataschema.py プロジェクト: Siyavula/emas.theme
from zope.interface import implements
from zope.schema import Int, Choice, TextLine, Date, List, Bool
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from plone.app.users.userdataschema import IUserDataSchemaProvider
from plone.app.users.userdataschema import IUserDataSchema
from emas.theme import MessageFactory as _

roles = SimpleVocabulary([
    SimpleTerm(value=u'Learner', title=_(u'Learner')),
    SimpleTerm(value=u'Educator', title=_(u'Educator')),
    SimpleTerm(value=u'Curriculum specialist',
               title=_(u'Curriculum specialist')),
    SimpleTerm(value=u'Other', title=_(u'Other'))
    ])

provinces = SimpleVocabulary([
    SimpleTerm(value=u'Eastern Cape', title=_(u'Eastern Cape')),
    SimpleTerm(value=u'Free State', title=_(u'Free State')),
    SimpleTerm(value=u'Gauteng', title=_(u'Gauteng')),
    SimpleTerm(value=u'KwaZulu-Natal', title=_(u'KwaZulu-Natal')),
    SimpleTerm(value=u'Limpopo', title=_(u'Limpopo')),
    SimpleTerm(value=u'Mpumalanga', title=_(u'Mpumalanga')),
    SimpleTerm(value=u'Northern Cape', title=_(u'Northern Cape')),
    SimpleTerm(value=u'North West', title=_(u'North West')),
    SimpleTerm(value=u'Western Cape', title=_(u'Western Cape')),
    ])

access_types = SimpleVocabulary([
    SimpleTerm(value=u'maths-grade-10', title=_(u'Maths grade 10')),
    SimpleTerm(value=u'maths-grade-11', title=_(u'Maths grade 11')),
    SimpleTerm(value=u'maths-grade-12', title=_(u'Maths grade 12')),
コード例 #4
0
ファイル: practice.py プロジェクト: Siyavula/emas.theme
 def add_noaccess_message(self):
     # set a portal message
     plone_utils = getToolByName(self.context, 'plone_utils')
     message = _(u'You do not currently have access to this service.')
     plone_utils.addPortalMessage(message, 'info')
     return message