def setUpWidgets(self, ignore_request=False):
        message = _(
            'request-message-default',
            'Hello,\n\nI would like to join ${groupName}. I think I should be allowed to '
            'become a member because...',
            mapping={'groupName': self.groupInfo.name})

        if self.userInfo.anonymous:
            fromAddr = ''
        else:
            emailUser = EmailUser(self.context, self.userInfo)
            addrs = emailUser.get_delivery_addresses()
            if addrs:
                fromAddr = addrs[0]
            else:
                fromAddr = ''

        data = {'message': translate(message), 'fromAddress': fromAddr}
        self.widgets = form.setUpWidgets(self.form_fields,
                                         self.prefix,
                                         self.context,
                                         self.request,
                                         form=self,
                                         data=data,
                                         ignore_request=ignore_request)
    def __init__(self, context):
        self.context = context
        # the context we are passed might already be a userinfo
        if IGSUserInfo.providedBy(context):
            self.userInfo = context
        else:
            self.userInfo = createObject('groupserver.LoggedInUser', context)

        emailUser = EmailUser(self.userInfo.user, self.userInfo)
        defaultAddresses = emailUser.get_delivery_addresses()
        self.defaultAddress = ''
        if defaultAddresses:
            self.defaultAddress = defaultAddresses[0]
    def __init__(self, context):
        self.context = context
        # the context we are passed might already be a userinfo
        if IGSUserInfo.providedBy(context):
            self.userInfo = context
        else:
            self.userInfo = createObject('groupserver.LoggedInUser',
                                         context)

        emailUser = EmailUser(self.userInfo.user, self.userInfo)
        defaultAddresses = emailUser.get_delivery_addresses()
        self.defaultAddress = ''
        if defaultAddresses:
            self.defaultAddress = defaultAddresses[0]
 def user_has_preferred_email_addresses(self):
     '''Does the user have at least one preferred (alias default
     delivery) email address to post. This is mostly a safety
     catch to ensure that the user has verified the email addresses.
     '''
     emailUser = EmailUser(self.groupInfo.groupObj, self.userInfo)
     preferredEmailAddresses = emailUser.get_delivery_addresses()
     retval = len(preferredEmailAddresses) >= 1
     if retval:
         self.__status = u'preferred email addresses'
     else:
         self.__status = u'no preferred email addresses'
         self.__statusNum = 4
     assert type(self.__status) == unicode
     assert type(retval) == bool
     return retval
 def user_has_preferred_email_addresses(self):
     '''Does the user have at least one preferred (alias default
     delivery) email address to post. This is mostly a safety
     catch to ensure that the user has verified the email addresses.
     '''
     emailUser = EmailUser(self.groupInfo.groupObj, self.userInfo)
     preferredEmailAddresses = emailUser.get_delivery_addresses()
     retval = len(preferredEmailAddresses) >= 1
     if retval:
         self.__status = u'preferred email addresses'
     else:
         self.__status = u'no preferred email addresses'
         self.__statusNum = 4
     assert type(self.__status) == unicode
     assert type(retval) == bool
     return retval
Example #6
0
    def check(self):
        if not self.s['checked']:
            emailUser = EmailUser(self.groupInfo.groupObj, self.userInfo)
            preferredEmailAddresses = emailUser.get_delivery_addresses()
            if (len(preferredEmailAddresses) >= 1):
                self.s['canPost'] = True
                self.s['status'] = u'a person with working email address.'
                self.s['statusNum'] = 0
            else:
                self.s['canPost'] = False
                self.s['status'] = u'no working email address.'
                self.s['statusNum'] = self.weight
            self.s['checked'] = True

        assert self.s['checked']
        assert type(self.s['canPost']) == bool
        assert type(self.s['status']) == unicode
        assert type(self.s['statusNum']) == int
    def check(self):
        if not self.s['checked']:
            emailUser = EmailUser(self.groupInfo.groupObj, self.userInfo)
            preferredEmailAddresses = emailUser.get_delivery_addresses()
            if (len(preferredEmailAddresses) >= 1):
                self.s['canPost'] = True
                self.s['status'] = u'a person with working email address.'
                self.s['statusNum'] = 0
            else:
                self.s['canPost'] = False
                self.s['status'] = u'no working email address.'
                self.s['statusNum'] = self.weight
            self.s['checked'] = True

        assert self.s['checked']                
        assert type(self.s['canPost']) == bool
        assert type(self.s['status']) == unicode
        assert type(self.s['statusNum']) == int
    def setUpWidgets(self, ignore_request=False):
        message = _('request-message-default',
                    'Hello,\n\nI would like to join ${groupName}. I think I should be allowed to '
                    'become a member because...',
                    mapping={'groupName': self.groupInfo.name})

        if self.userInfo.anonymous:
            fromAddr = ''
        else:
            emailUser = EmailUser(self.context, self.userInfo)
            addrs = emailUser.get_delivery_addresses()
            if addrs:
                fromAddr = addrs[0]
            else:
                fromAddr = ''

        data = {'message': translate(message), 'fromAddress': fromAddr}
        self.widgets = form.setUpWidgets(
            self.form_fields, self.prefix, self.context,
            self.request, form=self, data=data,
            ignore_request=ignore_request)
 def setUpWidgets(self, ignore_request=True):
     self.adapters = {}
     if self.userInfo.anonymous:
         fromAddr = ''
     else:
         emailUser = EmailUser(self.context, self.userInfo)
         addrs = emailUser.get_delivery_addresses()
         if addrs:
             fromAddr = addrs[0]
         else:
             fromAddr = ''
     data = {
         'fromAddress': fromAddr,
         'message': '',
         'inReplyTo': self.lastPostId,
     }
     self.widgets = form.setUpWidgets(
         self.form_fields, self.prefix, self.context,
         self.request, form=self, data=data,
         ignore_request=ignore_request)
     assert self.widgets
 def setUpWidgets(self, ignore_request=True):
     self.adapters = {}
     if self.userInfo.anonymous:
         fromAddr = ''
     else:
         emailUser = EmailUser(self.context, self.userInfo)
         addrs = emailUser.get_delivery_addresses()
         if addrs:
             fromAddr = addrs[0]
         else:
             fromAddr = ''
     data = {
         'fromAddress': fromAddr,
         'message': '',
         'inReplyTo': self.lastPostId,
     }
     self.widgets = form.setUpWidgets(self.form_fields,
                                      self.prefix,
                                      self.context,
                                      self.request,
                                      form=self,
                                      data=data,
                                      ignore_request=ignore_request)
     assert self.widgets
 def defaultFromEmail(self):
     emailUser = EmailUser(self.context, self.adminInfo)
     retval = emailUser.get_delivery_addresses()[0]
     return retval