Changeset 3152 in products for quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/content/sitemap.py
- Timestamp:
- Apr 20, 2011 8:20:36 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/content/sitemap.py
r3066 r3152 10 10 from Products.CMFCore.utils import getToolByName 11 11 12 from quintagroup.plonegooglesitemaps import qPloneGoogleSitemapsMessageFactory as _ 12 from quintagroup.plonegooglesitemaps \ 13 import qPloneGoogleSitemapsMessageFactory as _ 13 14 from quintagroup.plonegooglesitemaps.interfaces import ISitemap 14 from quintagroup.plonegooglesitemaps.config import * 15 from quintagroup.plonegooglesitemaps.config import * 15 16 16 17 SitemapSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema(( … … 19 20 atapi.StringField( 20 21 name='sitemapType', 21 storage =atapi.AnnotationStorage(),22 storage=atapi.AnnotationStorage(), 22 23 required=True, 23 24 default='content', … … 25 26 widget=atapi.SelectionWidget( 26 27 label=_(u"Sitemap type"), 27 visible = {'edit':'invisible', 'view':'invisible'},28 visible={'edit': 'invisible', 'view': 'invisible'}, 28 29 description=_(u"Select Type of the sitemap."), 29 30 ), … … 31 32 atapi.LinesField( 32 33 name='portalTypes', 33 storage =atapi.AnnotationStorage(),34 storage=atapi.AnnotationStorage(), 34 35 required=True, 35 default=['Document', ],36 default=['Document', ], 36 37 vocabulary_factory="plone.app.vocabularies.ReallyUserFriendlyTypes", 37 38 #schemata ='default', … … 43 44 atapi.LinesField( 44 45 name='states', 45 storage =atapi.AnnotationStorage(),46 storage=atapi.AnnotationStorage(), 46 47 required=True, 47 default=['published', ],48 default=['published', ], 48 49 vocabulary="getWorkflowStates", 49 50 #schemata ='default', 50 51 widget=atapi.MultiSelectionWidget( 51 52 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."), 54 55 ), 55 56 ), 56 57 atapi.LinesField( 57 58 name='blackout_list', 58 storage =atapi.AnnotationStorage(),59 storage=atapi.AnnotationStorage(), 59 60 required=False, 60 61 #default='', … … 63 64 label=_(u"Blackout entries"), 64 65 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."), 70 73 ), 71 74 ), 72 75 atapi.LinesField( 73 76 name='reg_exp', 74 storage =atapi.AnnotationStorage(),77 storage=atapi.AnnotationStorage(), 75 78 required=False, 76 79 #default='', … … 83 86 u"\"s/\/index_html//\" will remove /index_html " \ 84 87 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 " \ 86 90 u"fix URLs in the sitemap in case they are " \ 87 91 u"generated on the basis of your site internal" \ … … 92 96 atapi.LinesField( 93 97 name='urls', 94 storage =atapi.AnnotationStorage(),98 storage=atapi.AnnotationStorage(), 95 99 required=False, 96 100 #default='', … … 104 108 atapi.LinesField( 105 109 name='pingTransitions', 106 storage =atapi.AnnotationStorage(),110 storage=atapi.AnnotationStorage(), 107 111 required=False, 108 112 vocabulary='getWorkflowTransitions', … … 110 114 widget=atapi.MultiSelectionWidget( 111 115 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."), 113 118 ), 114 119 ), … … 121 126 SitemapSchema['id'].widget.ignore_visible_ids = True 122 127 SitemapSchema['title'].storage = atapi.AnnotationStorage() 123 SitemapSchema['title'].required=False 124 SitemapSchema['title'].widget.visible = {'edit':'invisible', 'view':'invisible'} 128 SitemapSchema['title'].required = False 129 SitemapSchema['title'].widget.visible = {'edit': 'invisible', 130 'view': 'invisible'} 125 131 SitemapSchema['description'].storage = atapi.AnnotationStorage() 126 SitemapSchema['description'].widget.visible = {'edit':'invisible', 'view':'invisible'} 132 SitemapSchema['description'].widget.visible = {'edit': 'invisible', 133 'view': 'invisible'} 127 134 128 135 schemata.finalizeATCTSchema(SitemapSchema, moveDiscussion=False) 129 SitemapSchema['relatedItems'].schemata='metadata' 130 SitemapSchema['relatedItems'].widget.visible = {'edit':'invisible', 'view':'invisible'} 136 SitemapSchema['relatedItems'].schemata = 'metadata' 137 SitemapSchema['relatedItems'].widget.visible = {'edit': 'invisible', 138 'view': 'invisible'} 139 131 140 132 141 class Sitemap(base.ATCTContent): … … 146 155 147 156 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()])) 150 159 states.sort() 151 160 return atapi.DisplayList(zip(states, states)) … … 153 162 def getWorkflowTransitions(self): 154 163 wf_trans = [] 155 pw = getToolByName(self, 'portal_workflow')164 pw = getToolByName(self, 'portal_workflow') 156 165 for wf_id in pw.getWorkflowIds(): 157 166 wf = pw.getWorkflowById(wf_id) … … 160 169 for wf_tr in wf.transitions.values(): 161 170 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()))) 164 174 return atapi.DisplayList(wf_trans) 165 175 … … 173 183 val = filter(None, map(string.strip, value)) 174 184 self.getField('blackout_list').set(self, val) 175 185 176 186 177 187 atapi.registerType(Sitemap, PROJECTNAME)
Note: See TracChangeset
for help on using the changeset viewer.