def get_post_intro_and_remainder(contentProvider, text):
    """Get the introduction and remainder text of the formatted post

:param object contentProvider: The content provider renderning the message, providing access to
                               the context, groupInfo and other useful tidbits.
:parm str text: The text to split into an introduction and remainder
:returns:  A 2-tuple of the strings that represent the email intro and the remainder."""
    if not contentProvider.groupInfo.groupObj:
        raise ValueError("The groupInfo object should always have a groupObj")

    if not text:
        # Sorry, Dijkstra
        return SplitMessage('', '')
    mailBody = wrap_message(text)
    plain = split_message(mailBody)

    messages = contentProvider.groupInfo.groupObj.messages
    perm = get_visibility(messages)

    ml = IGSMailingListInfo(contentProvider.groupInfo.groupObj)
    okAddresses = (contentProvider.siteInfo.get_support_email(),
                   ml.get_property('mailto'))

    markedUpIntro = ''
    if plain.intro:
        markedUpIntro = unicode(OnlineHTMLBody(plain.intro, perm, okAddresses))

    markedUpRemainder = ''
    if plain.remainder:
        markedUpRemainder = unicode(OnlineHTMLBody(plain.remainder, perm, okAddresses))

    retval = SplitMessage(markedUpIntro, markedUpRemainder)
    return retval
示例#2
0
    def group_to_dict(groupInfo):
        groupUnset = IUnsetType(groupInfo.groupObj)
        groupVisiblity = IGSGroupVisibility(groupInfo)
        try:
            l = IGSMailingListInfo(groupInfo.groupObj)
        except AttributeError as ae:
            raise NoList(ae)

        retval = OrderedDict((
            ('id', groupInfo.id),
            ('name', groupInfo.name),
            ('url', groupInfo.url),
            ('email', l.get_property('mailto')),
            ('type', groupUnset.name),
            ('privacy', groupVisiblity.visibility), ))
        return retval
def user_posting_member_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not an IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    mlistInfo = IGSMailingListInfo(context)
    retval = (user_member_of_group(userInfo, groupInfo)
              and (userInfo.id in [m.id for m in mlistInfo.posting_members]))
    assert type(retval) == bool
    return retval
示例#4
0
 def email(self):
     l = IGSMailingListInfo(self.groupInfo.groupObj)
     retval = l.get_property('mailto')
     return retval
 def email(self):
     l = IGSMailingListInfo(self.groupInfo.groupObj)
     retval = l.get_property('mailto')
     return retval
 def returnpath(self):
     li = IGSMailingListInfo(self.group)
     retval = li.get_property('mailto')
     return retval