Ignore:
Timestamp:
Apr 14, 2011 5:49:27 PM (12 years ago)
Author:
kroman0
Message:

Pyflakes and pep8 fixes #4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/utils.py

    r3116 r3117  
    4242 
    4343    prop_sheet = context.portal_properties['qPloneComments'] 
    44     props = filter(lambda x: prop_sheet.getProperty(x), prop_sheet.propertyIds()) 
     44    props = filter(lambda x: prop_sheet.getProperty(x), \ 
     45                   prop_sheet.propertyIds()) 
    4546 
    4647    actions = { 
     
    8687                [obj.Creator(), ] 
    8788            userid = creators and creators[0] or "" 
    88             creator = getToolByName(context, 'portal_membership').getMemberById(userid) 
     89            portal_membership = getToolByName(context, 'portal_membership') 
     90            creator = portal_membership.getMemberById(userid) 
    8991            if creator and allowEmail(context, reply, state, creator): 
    9092                return creator.getProperty('email', '') 
     
    105107    def getParentOwnerEmail(reply, context): 
    106108        creator_id = getParent(reply).getOwnerTuple()[1] 
    107         creator = getToolByName(context, 'portal_membership').getMemberById(creator_id) 
     109        portal_membership = getToolByName(context, 'portal_membership') 
     110        creator = portal_membership.getMemberById(creator_id) 
    108111        if creator and allowEmail(context, reply, state, creator): 
    109112            return creator.getProperty('email', '') 
     
    117120    organization_name = getProp(context, 'email_subject_prefix', '') 
    118121    creator_name = reply.getOwnerTuple()[1] 
    119     admin_email = context.portal_url.getPortalObject().getProperty('email_from_address') 
     122    portal = getToolByName(context, 'portal_url').getPortalObject() 
     123    admin_email = portal.getProperty('email_from_address') 
    120124    translate = getToolByName(context, 'translation_service').translate 
    121125    subject = '' 
     
    123127        subject = translate(_(u"approve_user_notification_subject", 
    124128            default=u"Your comment on ${title} is now published", 
    125             mapping={u"title": safe_unicode(getParent(context).title_or_id())}), 
     129            mapping={u"title": 
     130                safe_unicode(getParent(context).title_or_id())}), 
    126131            context=context.REQUEST) 
    127132        if user_email: 
     
    138143        subject = translate(_(u"rejected_user_notification_subject", 
    139144            default=u"Your comment on ${title} was not approved", 
    140             mapping={u"title": safe_unicode(getParent(context).title_or_id())}), 
     145            mapping={u"title": 
     146                safe_unicode(getParent(context).title_or_id())}), 
    141147            context=context.REQUEST) 
    142148        if user_email: 
     
    154160        subject = translate(_(u"reply_user_notification_subject", 
    155161            default=u"Someone replied to your comment on ${title}", 
    156             mapping={u"title": safe_unicode(getParent(context).title_or_id())}), 
     162            mapping={u"title": 
     163                safe_unicode(getParent(context).title_or_id())}), 
    157164            context=context.REQUEST) 
    158165        di_parrent = getDIParent(reply) 
     
    200207            args = {} 
    201208 
    202     elif state in ('enable_authenticated_report_abuse', 'enable_anonymous_report_abuse'): 
     209    elif state in ('enable_authenticated_report_abuse', 
     210                   'enable_anonymous_report_abuse'): 
    203211        template = 'report_abuse_template' 
    204212        user_email = getProp(context, "email_discussion_manager", None) 
     
    230238    if args: 
    231239        msg = getMsg(context, template, args) 
    232         charset = context.portal_properties.site_properties.getProperty('default_charset', 'utf-8') 
     240        site_properties = context.portal_properties.site_properties 
     241        charset = site_properties.getProperty('default_charset', 'utf-8') 
    233242        msg = msg.encode(charset) 
    234243        host = context.plone_utils.getMailHost() 
     
    236245            host.secureSend(msg, user_email, admin_email, subject=subject, 
    237246                            subtype='plain', debug=False, charset=charset) 
    238         except (smtplib.SMTPRecipientsRefused,smtplib.SMTPServerDisconnected): 
     247        except (smtplib.SMTPRecipientsRefused, smtplib.SMTPServerDisconnected): 
    239248            setStatusMsg(None, context, 
    240249                _('Could not send the email notification. Have you configured an email server for Plone?')) 
Note: See TracChangeset for help on using the changeset viewer.