Ignore:
Timestamp:
Apr 20, 2011 8:20:36 AM (13 years ago)
Author:
zidane
Message:

fixes pep8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/content/sitemap.py

    r3066 r3152  
    1010from Products.CMFCore.utils import getToolByName 
    1111 
    12 from quintagroup.plonegooglesitemaps import qPloneGoogleSitemapsMessageFactory as _ 
     12from quintagroup.plonegooglesitemaps \ 
     13    import qPloneGoogleSitemapsMessageFactory as _ 
    1314from quintagroup.plonegooglesitemaps.interfaces import ISitemap 
    14 from quintagroup.plonegooglesitemaps.config import *  
     15from quintagroup.plonegooglesitemaps.config import * 
    1516 
    1617SitemapSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema(( 
     
    1920    atapi.StringField( 
    2021        name='sitemapType', 
    21         storage = atapi.AnnotationStorage(), 
     22        storage=atapi.AnnotationStorage(), 
    2223        required=True, 
    2324        default='content', 
     
    2526        widget=atapi.SelectionWidget( 
    2627            label=_(u"Sitemap type"), 
    27             visible = {'edit':'invisible', 'view':'invisible'}, 
     28            visible={'edit': 'invisible', 'view': 'invisible'}, 
    2829            description=_(u"Select Type of the sitemap."), 
    2930        ), 
     
    3132    atapi.LinesField( 
    3233        name='portalTypes', 
    33         storage = atapi.AnnotationStorage(), 
     34        storage=atapi.AnnotationStorage(), 
    3435        required=True, 
    35         default=['Document',], 
     36        default=['Document', ], 
    3637        vocabulary_factory="plone.app.vocabularies.ReallyUserFriendlyTypes", 
    3738        #schemata ='default', 
     
    4344    atapi.LinesField( 
    4445        name='states', 
    45         storage = atapi.AnnotationStorage(), 
     46        storage=atapi.AnnotationStorage(), 
    4647        required=True, 
    47         default=['published',], 
     48        default=['published', ], 
    4849        vocabulary="getWorkflowStates", 
    4950        #schemata ='default', 
    5051        widget=atapi.MultiSelectionWidget( 
    5152            label=_(u"Review status"), 
    52             description=_(u"You may include items in sitemap depend of their " \ 
    53                           u"review state."), 
     53            description=_(u"You may include items in sitemap depend of " \ 
     54                          u"their review state."), 
    5455        ), 
    5556    ), 
    5657    atapi.LinesField( 
    5758        name='blackout_list', 
    58         storage = atapi.AnnotationStorage(), 
     59        storage=atapi.AnnotationStorage(), 
    5960        required=False, 
    6061        #default='', 
     
    6364            label=_(u"Blackout entries"), 
    6465            description=_( 
    65               u"Objects which match filter condition will be excluded from the sitemap." \ 
    66               u"Every record should follow the spec: [<filter name>:]<filter arguments>."\ 
    67               u" By default there are \"id\" and \"path\" filters (\"id\" used if filter"\ 
    68               u" name not specified). There is possibility to add new filters. "\ 
    69               u"Look into README.txt of the quintagroup.plonegooglesitemaps package."), 
     66                u"Objects which match filter condition will be excluded " \ 
     67                u"from the sitemap.Every record should follow the spec: " \ 
     68                u"[<filter name>:]<filter arguments>. By default there are " \ 
     69                u"\"id\" and \"path\" filters (\"id\" used if filter name " \ 
     70                u"not specified). There is possibility to add new filters. " \ 
     71                u"Look into README.txt of the " \ 
     72                u"quintagroup.plonegooglesitemaps package."), 
    7073        ), 
    7174    ), 
    7275    atapi.LinesField( 
    7376        name='reg_exp', 
    74         storage = atapi.AnnotationStorage(), 
     77        storage=atapi.AnnotationStorage(), 
    7578        required=False, 
    7679        #default='', 
     
    8386                          u"\"s/\/index_html//\" will remove /index_html " \ 
    8487                          u"from URLs representing default documents. " \ 
    85                           u"Example 2: \"s/[you_site\/internal\/path]/[domain]/\" will " \ 
     88                          u"Example 2: " \ 
     89                          u"\"s/[you_site\/internal\/path]/[domain]/\" will " \ 
    8690                          u"fix URLs in the sitemap in case they are " \ 
    8791                          u"generated on the basis of your site internal" \ 
     
    9296    atapi.LinesField( 
    9397        name='urls', 
    94         storage = atapi.AnnotationStorage(), 
     98        storage=atapi.AnnotationStorage(), 
    9599        required=False, 
    96100        #default='', 
     
    104108    atapi.LinesField( 
    105109        name='pingTransitions', 
    106         storage = atapi.AnnotationStorage(), 
     110        storage=atapi.AnnotationStorage(), 
    107111        required=False, 
    108112        vocabulary='getWorkflowTransitions', 
     
    110114        widget=atapi.MultiSelectionWidget( 
    111115            label=_(u"Pinging workflow transitions"), 
    112             description=_(u"Select workflow transitions for pinging google on."), 
     116            description=_(u"Select workflow transitions for pinging " \ 
     117                          u"google on."), 
    113118        ), 
    114119    ), 
     
    121126SitemapSchema['id'].widget.ignore_visible_ids = True 
    122127SitemapSchema['title'].storage = atapi.AnnotationStorage() 
    123 SitemapSchema['title'].required=False 
    124 SitemapSchema['title'].widget.visible = {'edit':'invisible', 'view':'invisible'} 
     128SitemapSchema['title'].required = False 
     129SitemapSchema['title'].widget.visible = {'edit': 'invisible', 
     130                                         'view': 'invisible'} 
    125131SitemapSchema['description'].storage = atapi.AnnotationStorage() 
    126 SitemapSchema['description'].widget.visible = {'edit':'invisible', 'view':'invisible'} 
     132SitemapSchema['description'].widget.visible = {'edit': 'invisible', 
     133                                               'view': 'invisible'} 
    127134 
    128135schemata.finalizeATCTSchema(SitemapSchema, moveDiscussion=False) 
    129 SitemapSchema['relatedItems'].schemata='metadata' 
    130 SitemapSchema['relatedItems'].widget.visible = {'edit':'invisible', 'view':'invisible'} 
     136SitemapSchema['relatedItems'].schemata = 'metadata' 
     137SitemapSchema['relatedItems'].widget.visible = {'edit': 'invisible', 
     138                                                'view': 'invisible'} 
     139 
    131140 
    132141class Sitemap(base.ATCTContent): 
     
    146155 
    147156    def getWorkflowStates(self): 
    148         pw = getToolByName(self,'portal_workflow') 
    149         states = list(set([v for k,v in pw.listWFStatesByTitle()])) 
     157        pw = getToolByName(self, 'portal_workflow') 
     158        states = list(set([v for k, v in pw.listWFStatesByTitle()])) 
    150159        states.sort() 
    151160        return atapi.DisplayList(zip(states, states)) 
     
    153162    def getWorkflowTransitions(self): 
    154163        wf_trans = [] 
    155         pw = getToolByName(self,'portal_workflow') 
     164        pw = getToolByName(self, 'portal_workflow') 
    156165        for wf_id in pw.getWorkflowIds(): 
    157166            wf = pw.getWorkflowById(wf_id) 
     
    160169            for wf_tr in wf.transitions.values(): 
    161170                if wf_tr.after_script_name in AVAILABLE_WF_SCRIPTS: 
    162                     wf_trans.append(("%s#%s" % (wf_id,wf_tr.id), 
    163                         "%s : %s (%s)" % (wf_id,wf_tr.id,wf_tr.title_or_id()))) 
     171                    wf_trans.append(("%s#%s" % (wf_id, wf_tr.id), 
     172                        "%s : %s (%s)" % (wf_id, wf_tr.id, \ 
     173                                          wf_tr.title_or_id()))) 
    164174        return atapi.DisplayList(wf_trans) 
    165175 
     
    173183        val = filter(None, map(string.strip, value)) 
    174184        self.getField('blackout_list').set(self, val) 
    175          
     185 
    176186 
    177187atapi.registerType(Sitemap, PROJECTNAME) 
Note: See TracChangeset for help on using the changeset viewer.