Changeset 3510 in products for quintagroup.plonegooglesitemaps/trunk
- Timestamp:
- Aug 22, 2012 10:22:22 AM (9 years ago)
- Location:
- quintagroup.plonegooglesitemaps/trunk
- Files:
-
- 33 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonegooglesitemaps/trunk
- Property svn:mergeinfo
-
old new 3 3 /quintagroup.plonegooglesitemaps/branches/migratioin_product:2826-2839 4 4 /quintagroup.plonegooglesitemaps/branches/plone4:2549-2553 5 /quintagroup.plonegooglesitemaps/branches/sitemap_date:3481-3509 5 6 /quintagroup.plonegooglesitemaps/branches/test_refactoring:2527-2536
-
- Property svn:mergeinfo
-
quintagroup.plonegooglesitemaps/trunk/README.txt
r3325 r3510 2 2 ============ 3 3 4 Plone Google Sitemaps product allows Plone websites to get better visibility forGoogle search engine5 by providing it with complete listing of URLs to website content.4 Plone Google Sitemaps product allows Plone websites to get better visibility on Google search engine 5 by providing it with a complete listing of content URLs to website. 6 6 7 7 .. figure:: http://quintagroup.com/services/plone-development/products/google-sitemaps/plone-google-sitemaps.png … … 15 15 16 16 * ``Content Sitemap`` - is a regular list of pages on your website. Creating and submitting such a Sitemap 17 lets Google know about all the pages on your Plone web 17 lets Google know about all the pages on your Plone website, including URLs that may not be discoverable 18 18 by Google's normal crawling process. 19 * ``Mobile Sitemap`` - is a specific type of Sitemap, that indexes all site URLs that serve content for 20 mobile devices. 19 * ``Mobile Sitemap`` - is a specific type of Sitemap, that indexes all site URLs that serve mobile-oriented content. 21 20 * ``News Sitemap`` - is different from regular Sitemaps, since it is specific to Google News only. 22 It uses the Sitemap protocol, with additional News-specific tags, defined by Google. The package brings 23 additional Google Sitem pas tab to News Item content type for defining NewsSitemap-specific meta tags.21 It uses the Sitemap protocol, with additional News-specific tags, defined by Google. The package brings protocol with 22 additional Google Sitemaps tab to News Item content type for defining NewsSitemap-specific meta tags. 24 23 25 Different Sitemap types index their own content and do not depend on other Sitemaps. 24 Different Sitemap types index their own content and do not depend on other Sitemaps. 26 25 27 26 Usage … … 39 38 ========= 40 39 41 If you UPGRADE older version of quintagroup.plonegooglesitemaps package to newer:42 --------------------------------------------------------------------------------- 40 If you UPGRADE an older version of quintagroup.plonegooglesitemaps package to a newer one: 41 ------------------------------------------------------------------------------------------ 43 42 44 * In your zope instance configuration or buildout -replace old package version with a new one.43 * In your zope instance configuration or buildout replace old package version with a new one. 45 44 * Run plone instance and reinstall package with Quickinstaller tool ("Add-on Products" in plone control panel). 46 45 47 If you rMIGRATE from Products.qPloneGoogleSitemaps to quintagroup.plonegooglesitemaps:48 ------------------------------------------------------------------------------------- -46 If you MIGRATE from Products.qPloneGoogleSitemaps to quintagroup.plonegooglesitemaps: 47 ------------------------------------------------------------------------------------- 49 48 50 * Add to new plone instance/buildout both qPloneGoogleSitemaps product and last version quintagroup.plonegooglesitemaps package.49 * Add to a new Plone instance/buildout both qPloneGoogleSitemaps product and last version quintagroup.plonegooglesitemaps package. 51 50 * Copy Data.fs from old Plone instance to new one. 52 * Start your new zope instance/buildout.51 * Start your new Zope instance/buildout. 53 52 54 53 The following steps are performed in the plone instance: -
quintagroup.plonegooglesitemaps/trunk/docs/HISTORY.txt
r3413 r3510 2 2 ========= 3 3 4 1. 7.1 - unreleased4 1.8.0 (2012-08-22) 5 5 ------------------ 6 6 7 * Updated modification date in Sitemaps for folderish objects which have 8 default pages. 9 Sitemap types have their own index (sitemap_date) 10 which helps to generate Sitemaps without default pages. 11 Index contains the last modification date from this object or 12 from default page. As а result you will not see default pages 13 in sitemap types. 14 [potar] 15 * Added tests for index (sitemap_date), updated tests. 16 [potar] 7 17 * Added deleting (button) the verification file 8 18 [potar] 9 10 19 * Updated view quintagroup.plonegooglesitemaps (tabs) 11 20 [potar] 21 12 22 13 23 1.7.0 (2011-10-28) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/Extensions/Install.py
r3152 r3510 20 20 step = None 21 21 profile_id = 'quintagroup.plonegooglesitemaps:default' 22 steps_to_run = [s['id'] for s in \22 steps_to_run = [s['id'] for s in 23 23 ps.listUpgrades(profile_id, show_old=False)] 24 24 for step_id in steps_to_run: -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/__init__.py
r3163 r3510 50 50 permission=config.ADD_PERMISSIONS[atype.portal_type], 51 51 extra_constructors=(constructor,), 52 ).initialize(context)52 ).initialize(context) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/commonview.py
r3163 r3510 110 110 fname = fspec and fspec.pop() or "id" 111 111 fengine = queryMultiAdapter((self.context, self.request), 112 interface=IBlackoutFilter, name=fname) 112 interface=IBlackoutFilter, 113 name=fname) 113 114 if fengine: 114 115 objects = list(fengine.filterOut(objects, fargs)) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/configletview.py
r3416 r3510 25 25 """ 26 26 27 sitemaps = Attribute("Returns mapping of sitemap's type to list of " \27 sitemaps = Attribute("Returns mapping of sitemap's type to list of " 28 28 "appropriate objects") 29 hasContentSM = Attribute("Returns boolean about existance of content " \29 hasContentSM = Attribute("Returns boolean about existance of content " 30 30 "sitemap") 31 hasMobileSM = Attribute("Returns boolean about existance of mobile " \31 hasMobileSM = Attribute("Returns boolean about existance of mobile " 32 32 "sitemap") 33 33 hasNewsSM = Attribute("Returns boolean about existance of news sitemap") … … 73 73 self.pps = queryMultiAdapter((self.context, self.request), 74 74 name="plone_portal_state") 75 self.sitemaps = [i.getObject() for i in \75 self.sitemaps = [i.getObject() for i in 76 76 self.tools.catalog()(portal_type='Sitemap')] 77 77 … … 97 97 smlist = sitemaps.setdefault(sm.getSitemapType(), []) 98 98 smlist.append({'url': sm.absolute_url(), 'id': sm.id}) 99 99 100 sitemaps['all'] = sitemaps.setdefault('content', []) + \ 100 sitemaps.setdefault('mobile', []) + \ 101 sitemaps.setdefault('news', []) 101 sitemaps.setdefault('mobile', []) + sitemaps.setdefault('news', []) 102 102 return sitemaps 103 103 … … 128 128 'sm_size': size and splitNum(size) or '', 129 129 'sm_entries': entries and splitNum(entries) or '', 130 }130 } 131 131 132 132 def getSitemapData(self, ob): … … 150 150 portal.manage_delObjects([self.request.id, ]) 151 151 self.request.RESPONSE.redirect( 152 153 152 urlparse.urljoin(self.context.absolute_url, 153 'prefs_gsm_verification')) 154 154 155 155 def getVerificationFiles(self): -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/mobilesitemapview.py
r3163 r3510 13 13 14 14 additional_maps = ( 15 ('modification_date', lambda x: DateTime(x.ModificationDate).HTML4()), 15 ('modification_date', 16 lambda x: x.sitemap_date or DateTime(x.ModificationDate).HTML4()), 16 17 ) 17 18 … … 22 23 review_state=self.context.getStates(), 23 24 object_provides=MOBILE_INTERFACES, 24 ) 25 is_default_page=False, 26 ) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/newssitemapview.py
r3163 r3510 21 21 22 22 return ( 23 ('publication_date', lambda x: x.Date and \24 23 ('publication_date', 24 lambda x: x.Date and formatDate(x.Date) or ""), 25 25 ('keywords', lambda x: x.Subject and ', '.join(x.Subject) or ""), 26 26 ('title', lambda x: x.Title or x.getId or x.id), 27 ('name', lambda x: x.Title and \28 27 ('name', lambda x: x.Title and 28 reTrailingParenthtical.sub("", x.Title) or ""), 29 29 ('language', lambda x: x.Language or self.default_language()), 30 30 ('access', lambda x: x.gsm_access or ""), 31 ('genres', lambda x: x.gsm_genres and \32 31 ('genres', lambda x: x.gsm_genres and 32 ", ".join(x.gsm_genres) or ""), 33 33 ('stock', lambda x: x.gsm_stock or ""), 34 34 ) … … 47 47 review_state=self.context.getStates(), 48 48 effective={"query": min_date, 49 "range": "min"} 50 ) 49 "range": "min"}, 50 is_default_page=False 51 ) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/sitemapview.py
r3163 r3510 11 11 12 12 additional_maps = ( 13 ('modification_date', lambda x: DateTime(x.ModificationDate).HTML4()), 13 ('modification_date', 14 lambda x: x.sitemap_date or DateTime(x.ModificationDate).HTML4()), 14 15 ) 15 16 … … 18 19 path=self.search_path, 19 20 portal_type=self.context.getPortalTypes(), 20 review_state=self.context.getStates() 21 ) 21 review_state=self.context.getStates(), 22 is_default_page=False 23 ) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/configure.zcml
r3306 r3510 29 29 </class> 30 30 31 <adapter name="sitemap_date" factory=".indexers.sitemap_date" /> 32 33 <subscriber 34 for="zope.interface.Interface 35 Products.Archetypes.interfaces.IObjectEditedEvent" 36 handler=".handlers.reindexParentObjects" /> 37 31 38 <!-- Register default filters --> 32 39 <adapter -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/content/newsextender.py
r3152 r3510 22 22 23 23 access_lst = ["Subscription", "Registration"] 24 genres_lst = ["PressRelease", "Satire", "Blog", "OpEd", "Opinion", \24 genres_lst = ["PressRelease", "Satire", "Blog", "OpEd", "Opinion", 25 25 "UserGenerated"] 26 26 … … 31 31 32 32 fields = [ 33 ExtendableStringField("gsm_access", 33 ExtendableStringField( 34 "gsm_access", 34 35 accessor="gsm_access", 35 vocabulary=DisplayList(zip(["", ] + access_lst, \36 vocabulary=DisplayList(zip(["", ] + access_lst, 36 37 ["Open access", ] + access_lst)), 37 38 default="", … … 39 40 widget=SelectionWidget( 40 41 label="Access", 41 description="Specifies whether an article is available to " \42 "all readers (in case of the emtpy field, or only to " \42 description="Specifies whether an article is available to " 43 "all readers (in case of the emtpy field, or only to " 43 44 "those with a free or paid membership to your site.", 44 45 format="radio"), 45 46 ), 46 ExtendableLinesField("gsm_genres", 47 ExtendableLinesField( 48 "gsm_genres", 47 49 accessor="gsm_genres", 48 50 vocabulary=DisplayList(zip(genres_lst, genres_lst)), … … 51 53 widget=MultiSelectionWidget( 52 54 label="Genres", 53 description="Select one or more properties for an article, " \54 "namely, whether it is a press release, a blog post, an " \55 "opinion, an op-ed piece, user-generated content, " \56 "or satire.",55 description="Select one or more properties for an article, " 56 "namely, whether it is a press release, " 57 "a blog post, an opinion, an op-ed piece, " 58 "user-generated content, or satire.", 57 59 format="checkbox"), 58 60 ), 59 ExtendableStringField("gsm_stock", 61 ExtendableStringField( 62 "gsm_stock", 60 63 accessor="gsm_stock", 61 64 default="", … … 63 66 widget=StringWidget( 64 67 label="Stock Tickers", 65 description="A comma-separated list of up to 5 stock tickers " \66 "of the companies, mutual funds, or other financial " \67 "entities that are the main subject of the article. " \68 "Relevant primarily for business articles. Each ticker " \69 "must be prefixed by the name of its stock exchange, " \70 "and must match its entry in Google Finance. " \71 "For example, \"NASDAQ:AMAT\" (but not \"NASD:AMAT\"), " \68 description="A comma-separated list of up to 5 stock tickers " 69 "of the companies, mutual funds, or other financial " 70 "entities that are the main subject of the article. " 71 "Relevant primarily for business articles. Each ticker " 72 "must be prefixed by the name of its stock exchange, " 73 "and must match its entry in Google Finance. " 74 "For example, \"NASDAQ:AMAT\" (but not \"NASD:AMAT\"), " 72 75 "or \"BOM:500325\" (but not \"BOM:RIL\").", 73 76 size=70), -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/content/sitemap.py
r3163 r3510 52 52 widget=atapi.MultiSelectionWidget( 53 53 label=_(u"Review status"), 54 description=_(u"You may include items in sitemap depend of " \54 description=_(u"You may include items in sitemap depend of " 55 55 u"their review state."), 56 56 ), … … 65 65 label=_(u"Blackout entries"), 66 66 description=_( 67 u"Objects which match filter condition will be excluded " \68 u"from the sitemap.Every record should follow the spec: " \69 u"[<filter name>:]<filter arguments>. By default there are " \70 u"\"id\" and \"path\" filters (\"id\" used if filter name " \71 u"not specified). There is possibility to add new filters. " \72 u"Look into README.txt of the " \67 u"Objects which match filter condition will be excluded " 68 u"from the sitemap.Every record should follow the spec: " 69 u"[<filter name>:]<filter arguments>. By default there are " 70 u"\"id\" and \"path\" filters (\"id\" used if filter name " 71 u"not specified). There is possibility to add new filters. " 72 u"Look into README.txt of the " 73 73 u"quintagroup.plonegooglesitemaps package."), 74 74 ), … … 82 82 widget=atapi.LinesWidget( 83 83 label=_(u"URL processing Regular Expressions"), 84 description=_(u"Provide regular expressions (in Perl syntax), " \85 u"one per line to be applied to URLs before " \86 u"including them into Sitemap. Example 1: " \87 u"\"s/\/index_html//\" will remove /index_html " \88 u"from URLs representing default documents. " \89 u"Example 2: " \90 u"\"s/[you_site\/internal\/path]/[domain]/\" will " \91 u"fix URLs in the sitemap in case they are " \92 u"generated on the basis of your site internal" \84 description=_(u"Provide regular expressions (in Perl syntax), " 85 u"one per line to be applied to URLs before " 86 u"including them into Sitemap. Example 1: " 87 u"\"s/\/index_html//\" will remove /index_html " 88 u"from URLs representing default documents. " 89 u"Example 2: " 90 u"\"s/[you_site\/internal\/path]/[domain]/\" will " 91 u"fix URLs in the sitemap in case they are " 92 u"generated on the basis of your site internal" 93 93 u"path rather than your site domain URL. "), 94 94 ), … … 103 103 widget=atapi.LinesWidget( 104 104 label=_(u"Additional URLs"), 105 description=_(u"Define additional URLs that are not objects and " \105 description=_(u"Define additional URLs that are not objects and " 106 106 u"that should be included in sitemap."), 107 107 ), … … 115 115 widget=atapi.MultiSelectionWidget( 116 116 label=_(u"Pinging workflow transitions"), 117 description=_(u"Select workflow transitions for pinging " \117 description=_(u"Select workflow transitions for pinging " 118 118 u"google on."), 119 119 ), … … 170 170 for wf_tr in wf.transitions.values(): 171 171 if wf_tr.after_script_name in AVAILABLE_WF_SCRIPTS: 172 wf_trans.append(("%s#%s" % (wf_id, wf_tr.id), 173 "%s : %s (%s)" % (wf_id, wf_tr.id, \ 174 wf_tr.title_or_id()))) 172 wf_trans.append( 173 ("%s#%s" % (wf_id, wf_tr.id), 174 "%s : %s (%s)" % (wf_id, wf_tr.id, 175 wf_tr.title_or_id()))) 175 176 return atapi.DisplayList(wf_trans) 176 177 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/events.py
r3163 r3510 12 12 implements(ITransitionEvent) 13 13 14 def __init__(self, obj, workflow, old_state, new_state, transition, \14 def __init__(self, obj, workflow, old_state, new_state, transition, 15 15 status, kwargs): 16 16 ObjectEvent.__init__(self, obj) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/filters.py
r3152 r3510 34 34 # absolute path filter 35 35 portal_id = queryMultiAdapter((self.context, self.request), 36 name=u"plone_portal_state").portal().getId() 36 name=u"plone_portal_state" 37 ).portal().getId() 37 38 test_path = '/' + portal_id + fargs 38 39 elif fargs.startswith("./"): -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/filters.txt
r3247 r3510 157 157 >>> reloc = re.compile("<loc>%s([^\<]*)</loc>" % self.portal.absolute_url(), re.S) 158 158 159 Test if all 4 documents a nd default front-page are in the sitemap without filters.159 Test if all 4 documents are in the sitemap without filters. 160 160 161 161 >>> no_filters_res = reloc.findall(no_filters_content) … … 166 166 /doc1 167 167 /doc2 168 /front-page169 168 170 169 … … 172 171 ================= 173 172 174 Go to the sitemap edit form and add "doc1" and "front-page" lineswith "id:"173 Go to the sitemap edit form and add "doc1" line with "id:" 175 174 prefix to the "Blackout entries" field. 176 175 … … 179 178 >>> filtercontrol.value = """ 180 179 ... id:doc1 181 ... id:front-page182 180 ... """ 183 181 >>> browser.getControl("Save").click() 184 182 >>> id_filter_content = browser.contents 185 183 186 "doc1" and "front-page" documentsshould now be excluded from the184 "doc1" document should now be excluded from the 187 185 sitemap. 188 186 … … 197 195 =================== 198 196 199 Suppose we want to exclude " front_page" from portal root and "doc2"200 document,located in test_user_1_ home folder, but leave "doc2"197 Suppose we want to exclude "doc2" document, 198 located in test_user_1_ home folder, but leave "doc2" 201 199 untouched in portal root with all other objects. 202 200 … … 205 203 >>> filtercontrol.value = """ 206 204 ... path:/Members/test_user_1_/doc2 207 ... path:/front-page208 205 ... """ 209 206 >>> browser.getControl("Save").click() 210 207 >>> path_filter_content = browser.contents 211 208 212 "/Members/test_user_1_/doc2" and "/front_page" objectsshould209 "/Members/test_user_1_/doc2" object should 213 210 be excluded from the sitemap. 214 211 … … 227 224 filter name prefix is specified (e.g. old-fashion filters)?" 228 225 229 Go to the sitemap edit form and add "doc1" and "front-page"230 lineswithout any filter name prefix to the "Blackout entries"226 Go to the sitemap edit form and add "doc1" line 227 without any filter name prefix to the "Blackout entries" 231 228 field. 232 229 … … 235 232 >>> filtercontrol.value = """ 236 233 ... doc1 237 ... front-page238 234 ... """ 239 235 >>> browser.getControl("Save").click() 240 236 >>> default_filter_content = browser.contents 241 237 242 "id" filter must be used as default filter. So, all "doc1" and243 "front-page" objectsshould be excluded from the sitemap.238 "id" filter must be used as default filter. So, "doc1" 239 object should be excluded from the sitemap. 244 240 245 241 >>> default_filter_res = reloc.findall(default_filter_content) … … 337 333 /Members/test_user_1_/doc2 338 334 /doc2 339 /front-page -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/handlers.py
r3163 r3510 3 3 #from quintagroup.plonegooglesitemaps.events import AfterTransitionEvent 4 4 from Products.DCWorkflow.interfaces import IAfterTransitionEvent 5 from quintagroup.plonegooglesitemaps.utils import ping_google 5 from Acquisition import aq_parent 6 7 from quintagroup.plonegooglesitemaps.utils import ping_google, isDefaultPage 6 8 7 9 … … 23 25 obj_ptype = object.portal_type 24 26 for sm in sitemaps: 25 if wftrans_name in sm.getPingTransitions() \26 andobj_ptype in sm.getPortalTypes():27 if wftrans_name in sm.getPingTransitions() and \ 28 obj_ptype in sm.getPortalTypes(): 27 29 ping_google(plone_home, sm.id) 28 30 return 0 31 32 33 def reindexParentObjects(obj, event): 34 """ Method reindexes folderish objects according 35 to modification date from default object 36 """ 37 def reindex(obj): 38 container = aq_parent(obj) 39 if isDefaultPage(obj): 40 container.reindexObject(['sitemap_date']) 41 reindex(container) 42 43 reindex(obj) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/profiles/default/catalog.xml
r2421 r3510 1 1 <?xml version="1.0"?> 2 2 <object name="portal_catalog" meta_type="Plone Catalog Tool"> 3 <index name="sitemap_date" meta_type="FieldIndex"> 4 <indexed_attr value="sitemap_date"/> 5 </index> 6 <column value="sitemap_date"/> 3 7 <column value="canonical_link" update="True" /> 4 8 <column value="Language" update="True" /> -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/setuphandlers.py
r3163 r3510 31 31 name = registration.name 32 32 lsm.unregisterAdapter(factory=factory, 33 required=required, provided=provided, name=name) 33 required=required, 34 provided=provided, 35 name=name) 34 36 unregistered.append(str(required)) 35 logger.info("Unregistered news schema extender adapters for: %s" \37 logger.info("Unregistered news schema extender adapters for: %s" 36 38 % unregistered) 37 39 … … 87 89 if old_product in configlet_ids: 88 90 controlpanel.unregisterConfiglet(old_product) 89 logger.info("Unregistered '%s' configlet from " \91 logger.info("Unregistered '%s' configlet from " 90 92 "portal_controlpanel tool." % old_product) 91 93 # Remove qPloneGoogleSitemaps skin layer … … 94 96 paths = [l.strip() for l in skin_paths if not l == old_product] 95 97 if len(paths) < len(skin_paths): 96 logger.info("Removed '%s' from '%s' skin." \98 logger.info("Removed '%s' from '%s' skin." 97 99 % (old_product, skinName)) 98 100 skins.addSkinSelection(skinName, ','.join(paths)) … … 103 105 if smaps: 104 106 logger.info(msg + "Process %s sitemaps." % ( 105 [sm.getPath() for sm in smaps]))107 [sm.getPath() for sm in smaps])) 106 108 fields = ['id', 'sitemapType', 'portalTypes', 'states', 107 109 'blackout_list', 'reg_exp', 'urls', 'pingTransitions'] … … 127 129 catalog = getToolByName(site, 'portal_catalog') 128 130 smaps = catalog(portal_type="Sitemap") 129 old_smb = [smb for smb in smaps \131 old_smb = [smb for smb in smaps 130 132 if 'qPloneGoogleSitemaps' in str(smb.getObject().__class__)] 131 133 return old_smb -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testBlackoutList.py
r3163 r3510 16 16 def testDefaultId(self): 17 17 idfilter = queryMultiAdapter((self.portal, self.app.REQUEST), 18 IBlackoutFilter, name="id")18 IBlackoutFilter, name="id") 19 19 self.assertTrue(idfilter is not None, 20 "Not registered default 'id' IBlackoutFilter")20 "Not registered default 'id' IBlackoutFilter") 21 21 22 22 def testDefaultPath(self): 23 23 pathfilter = queryMultiAdapter((self.portal, self.app.REQUEST), 24 IBlackoutFilter, name="path")24 IBlackoutFilter, name="path") 25 25 self.assertTrue(pathfilter is not None, 26 "Not registered default 'path' IBlackoutFilter")26 "Not registered default 'path' IBlackoutFilter") 27 27 28 28 … … 59 59 catpaths, filtered = self.getPreparedLists("id", "doc1") 60 60 self.assertTrue(type(filtered) in [ListType, TupleType], 61 'Object type, returned by filteredOut method of "id" filter '\ 62 'not list nor tuple') 61 'Object type, returned by filteredOut method' 62 ' of "id" filter ' 63 'not list nor tuple') 63 64 excluded = ["/%s/doc1" % self.portal.absolute_url(1), 64 65 "/%s/doc1" % self.folder.absolute_url(1)] 65 66 self.assertTrue( 66 67 set(catpaths) - set(filtered) == set(excluded), 67 'Wrong filtered-out by "id" filter:\nsrc %s\nres %s\nexcluded %s' \68 'Wrong filtered-out by "id" filter:\nsrc %s\nres %s\nexcluded %s' 68 69 % (catpaths, filtered, excluded)) 69 70 … … 71 72 catpaths, filtered = self.getPreparedLists("path", "/doc1") 72 73 self.assertTrue(type(filtered) in [ListType, TupleType], 73 'Object type, returned by filteredOut method of "path" filter '\ 74 'not list nor tuple') 74 'Object type, returned by filteredOut method' 75 ' of "path" filter ' 76 'not list nor tuple') 75 77 excluded = ["/%s/doc1" % self.portal.absolute_url(1)] 76 78 self.assertTrue( 77 79 set(catpaths) - set(filtered) == set(excluded), 78 'Wrong filtered-out by "path" filter:\nsrc %s\nres %s\nexcluded ' \80 'Wrong filtered-out by "path" filter:\nsrc %s\nres %s\nexcluded ' 79 81 '%s' % (catpaths, filtered, excluded)) 80 82 … … 84 86 catpaths, filtered = self.getPreparedLists("path", "./doc1") 85 87 self.assertTrue(type(filtered) in [ListType, TupleType], 86 'Object type, returned by filteredOut method of "path" utility '\ 87 'not list nor tuple') 88 'Object type, returned by filteredOut method' 89 ' of "path" utility ' 90 'not list nor tuple') 88 91 excluded = ["/%s/doc1" % self.folder.absolute_url(1)] 89 92 self.assertTrue( 90 93 set(catpaths) - set(filtered) == set(excluded), 91 'Wrong filtered-out by "path" filter:\nsrc %s\nres %s\nexcluded ' \94 'Wrong filtered-out by "path" filter:\nsrc %s\nres %s\nexcluded ' 92 95 '%s' % (catpaths, filtered, excluded)) 93 96 … … 109 112 def testGetNamedFilterUtility(self): 110 113 catpaths, filtered = self.getPreparedLists("path:/doc1", "/plone/doc1") 111 excluded = ["%s/doc1" % self.portal.absolute_url()] 114 excluded = ["%s/doc1" % self.portal.absolute_url(), 115 "%s/front-page" % self.portal.absolute_url()] 112 116 self.assertTrue(set(catpaths) - set(filtered) == set(excluded), 113 'Wrong filtered-out by "id" filter:\nsrc %s\nres %s\nexcluded %s' \ 114 % (catpaths, filtered, excluded)) 117 'Wrong filtered-out by' 118 ' "id" filter:\nsrc %s\nres %s\nexcluded %s' 119 % (catpaths, filtered, excluded)) 115 120 116 121 def testDefaultFilterUtility(self): 117 122 catpaths, filtered = self.getPreparedLists("id:doc1", "doc1") 118 123 excluded = ["%s/doc1" % self.portal.absolute_url(), 124 "%s/front-page" % self.portal.absolute_url(), 119 125 "%s/doc1" % self.folder.absolute_url()] 120 126 self.assertTrue(set(catpaths) - set(filtered) == set(excluded), 121 'Wrong filtered-out by "id" filter:\nsrc %s\nres %s\nexcluded %s' \ 122 % (catpaths, filtered, excluded)) 127 'Wrong filtered-out by "id" ' 128 'filter:\nsrc %s\nres %s\nexcluded %s' 129 % (catpaths, filtered, excluded)) 123 130 # Now check is output of unnamed filter samed to named one. 124 131 self.sm.edit(blackout_list=["doc1", ]) … … 126 133 map(lambda l: l.sort(), (filtered, filtered_dflt)) 127 134 self.assertTrue(filtered == filtered_dflt, 128 'Output of named "id" filter is not same to unnamed one:\n' \ 129 'id-named: %s\nunnamed: %s' % (filtered, filtered_dflt)) 135 'Output of named "id" filter ' 136 'is not same to unnamed one:\n' 137 'id-named: %s\nunnamed: %s' 138 % (filtered, filtered_dflt)) 130 139 131 140 # def testGetCorrectFilterName(self): -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testConfiglet.py
r3163 r3510 32 32 33 33 def testAddContentSitemap(self): 34 resp = self.submitForm( 35 {'form.button.AddContent':"Add Content Sitemap"})34 resp = self.submitForm({'form.button.AddContent': 35 "Add Content Sitemap"}) 36 36 self.assertEqual(resp.getStatus() / 100, 3) 37 37 sm_edit = "sitemap.xml/edit" … … 41 41 #self.portal["sitemap.xml"].setPortalTypes(("Documents",)) 42 42 newform = self.publish(self.settingsURL, basic=self.auth).getBody() 43 self.assertEqual('href="http://nohost/plone/sitemap.xml/edit"' in \43 self.assertEqual('href="http://nohost/plone/sitemap.xml/edit"' in 44 44 newform, True) 45 45 self.assertEqual("form.button.AddContent" in newform, False) … … 54 54 #self.portal["news-sitemap.xml"].setPortalTypes(("News Item",)) 55 55 newform = self.publish(self.settingsURL, basic=self.auth).getBody() 56 self.assertEqual('href="http://nohost/plone/news-sitemap.xml/edit"' \56 self.assertEqual('href="http://nohost/plone/news-sitemap.xml/edit"' 57 57 in newform, True) 58 58 self.assertEqual("form.button.AddNews" in newform, False) … … 67 67 #self.portal["mobile-sitemap.xml"].setPortalTypes(("Documents",)) 68 68 newform = self.publish(self.settingsURL, basic=self.auth).getBody() 69 self.assertEqual('href="http://nohost/plone/mobile-sitemap.xml/edit"' \69 self.assertEqual('href="http://nohost/plone/mobile-sitemap.xml/edit"' 70 70 in newform, True) 71 71 self.assertEqual("form.button.AddMobile" in newform, False) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testGoogleSitemaps.py
r3163 r3510 89 89 '/prefs_gsm_verification' 90 90 verif_config = self.publish(verifyConfigUrl, self.auth).getBody() 91 rexp_input_acitve = re.compile('<input\s+name="verification_file"' \91 rexp_input_acitve = re.compile('<input\s+name="verification_file"' 92 92 '\s+([^>]*)>', re.I | re.S) 93 93 rexp_button_acitve = re.compile( … … 101 101 102 102 self.assert_(input_acitve and not 'disabled' in input_acitve.groups(1)) 103 self.assert_(button_acitve and not 'disabled' in \103 self.assert_(button_acitve and not 'disabled' in 104 104 button_acitve.groups(1)) 105 105 self.assert_(not delete_button) … … 143 143 144 144 self.assertEqual(response.getStatus(), 200) 145 self.assert_(fname in \ 146 self.gsm_props.getProperty('verification_filenames', []), 147 self.gsm_props.getProperty('verification_filenames', [])) 145 self.assert_(fname in 146 self.gsm_props.getProperty('verification_filenames', 147 []), 148 self.gsm_props.getProperty('verification_filenames', 149 [])) 148 150 fnames.append(fname) 149 151 150 self.assertEqual(len([1 for vf in fnames \ 151 if vf in \ 152 self.gsm_props.getProperty('verification_filenames', [])]), 2, 153 self.gsm_props.getProperty('verification_filenames', [])) 152 self.assertEqual(len([1 for vf in fnames 153 if 154 vf 155 in 156 self.gsm_props.getProperty('verification_filenames', 157 [])]), 2, 158 self.gsm_props.getProperty('verification_filenames', 159 [])) 154 160 155 161 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testInstallation.py
r3163 r3510 15 15 pt = self.portal.portal_types 16 16 self.assert_('Sitemap' in pt.objectIds(), 17 'No "Sitemap" type after installation')17 'No "Sitemap" type after installation') 18 18 #Test views 19 19 views = pt.getTypeInfo('Sitemap').view_methods 20 20 self.assert_('sitemap.xml' in views, 21 'No "sitemap.xml" view for Sitemap type')21 'No "sitemap.xml" view for Sitemap type') 22 22 self.assert_('mobile-sitemap.xml' in views, 23 'No "mobile-sitemap.xml" view for Sitemap type')23 'No "mobile-sitemap.xml" view for Sitemap type') 24 24 self.assert_('news-sitemap.xml' in views, 25 'No "news-sitemap.xml" view for Sitemap type')25 'No "news-sitemap.xml" view for Sitemap type') 26 26 27 27 def testGSMProperties(self): … … 29 29 30 30 # Test types_not_searched 31 self.assert_("Sitemap" in \ 32 pp['site_properties'].getProperty('types_not_searched'), 33 'No "Sitemap" added to types not searched on installation') 31 self.assert_("Sitemap" in 32 pp['site_properties'].getProperty('types_not_searched'), 33 'No "Sitemap" added to types not searched ' 34 'on installation') 34 35 # Test metaTypesNotToList 35 self.assert_("Sitemap" in \ 36 pp['navtree_properties'].getProperty('metaTypesNotToList'), 37 'No "Sitemap" added to types not to list on installation') 36 self.assert_("Sitemap" in 37 pp['navtree_properties']. 38 getProperty('metaTypesNotToList'), 39 'No "Sitemap" added to types not to ' 40 'list on installation') 38 41 39 42 # Test 'googlesitemap_properties' 40 43 self.assert_('googlesitemap_properties' in pp.objectIds(), 41 'No "googlesitemap_properties" after installation')44 'No "googlesitemap_properties" after installation') 42 45 qsmprops = pp['googlesitemap_properties'] 43 46 self.assert_(qsmprops.hasProperty('verification_filenames'), 44 'No "verification_filenames" property added on installation') 47 'No "verification_filenames" property added on ' 48 'installation') 45 49 46 50 def testSkins(self): 47 51 ps = self.portal.portal_skins 48 52 self.assert_('plonegooglesitemaps' in ps.objectIds(), 49 'No "plonegooglesitemaps" skin layer in portal_skins') 50 self.assert_('plonegooglesitemaps' in \ 53 'No "plonegooglesitemaps" skin ' 54 'layer in portal_skins') 55 self.assert_('plonegooglesitemaps' in 51 56 ps.getSkinPath(ps.getDefaultSkin()), 52 'No "plonegooglesitemaps" skin layer in default skin') 57 'No "plonegooglesitemaps" skin layer ' 58 'in default skin') 53 59 54 60 def testConfiglet(self): 55 61 cp = self.portal.portal_controlpanel 56 self.assert_([1 for ai in cp.listActionInfos() \ 57 if ai['id'] == 'GoogleSitemaps'], 58 'No "GoogleSitemaps" configlet added to plone control panel') 62 self.assert_([1 for ai in cp.listActionInfos() 63 if ai['id'] == 'GoogleSitemaps'], 64 'No "GoogleSitemaps" configlet ' 65 'added to plone control panel') 59 66 60 67 def testNewsSchemaExtenderRegistered(self): … … 62 69 news = self.portal.invokeFactory("News Item", id="test_news") 63 70 news = getattr(self.portal, "test_news") 64 self.assertNotEqual(lsm.queryAdapter( 65 news, interface=ISchemaExtender, 66 name="quintagroup.plonegooglesitemaps.newssitemapextender"), 67 None) 71 adapter = "quintagroup.plonegooglesitemaps.newssitemapextender" 72 self.assertNotEqual(lsm.queryAdapter(news, 73 interface=ISchemaExtender, 74 name=adapter), 75 None) 68 76 69 77 def testUpdateCatalog(self): … … 135 143 news = getattr(self.portal, "test_news") 136 144 self.assertEqual(lsm.queryAdapter(news, interface=ISchemaExtender), 137 None)145 None) 138 146 139 147 def testConfigletUninstall(self): … … 142 150 True, '%s is already installed' % PRODUCT) 143 151 configTool = self.portal.portal_controlpanel 144 self.assertEqual('GoogleSitemaps' in [a.getId() for a in \ 145 configTool.listActions()], False, 146 'Configlet found after uninstallation') 152 self.assertEqual('GoogleSitemaps' in [a.getId() for a in 153 configTool.listActions()], 154 False, 155 'Configlet found after uninstallation') 147 156 148 157 def test_browserlayer_uninstall(self): … … 152 161 from plone.browserlayer import utils 153 162 self.assertEqual(IGoogleSitemapsLayer in utils.registered_layers(), 154 False, "Still registered 'IGoogleSitemapsLayer' browser layer") 163 False, "Still registered 'IGoogleSitemapsLayer' " 164 "browser layer") 155 165 156 166 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testMobileSitemaps.py
r3163 r3510 40 40 def reParse(self): 41 41 # Parse mobile sitemap 42 self.sitemap = self.publish("/" + self.portal.absolute_url(1) + \42 self.sitemap = self.publish("/" + self.portal.absolute_url(1) + 43 43 "/mobile-sitemap.xml", 44 44 "%s:%s" % (portal_owner, … … 64 64 65 65 def test_lastmod(self): 66 md = [f for k, f in \67 mobilesitemapview.MobileSitemapView.additional_maps \66 md = [f for k, f in 67 mobilesitemapview.MobileSitemapView.additional_maps 68 68 if k == 'modification_date'][0] 69 69 bmobile = self.portal.portal_catalog(id="my_mobile")[0] 70 70 self.assert_("lastmod" in self.start.keys()) 71 self.assert_(md(bmobile) in self.data, "Wrong 'modified date':" \72 " must be '%s', but exist: '%s'" \71 self.assert_(md(bmobile) in self.data, "Wrong 'modified date':" 72 " must be '%s', but exist: '%s'" 73 73 % (md(bmobile), self.data)) 74 74 … … 85 85 self.default_layout = mobile_sm.getProperty('layout', "") 86 86 self.mobile_view = queryMultiAdapter((mobile_sm, self.portal.REQUEST), 87 name=self.default_layout)87 name=self.default_layout) 88 88 89 89 def testLayout(self): … … 100 100 def testAdditionalMaps(self): 101 101 self.assert_(hasattr(self.mobile_view, "additional_maps")) 102 self.assert_([1 for k, f in self.mobile_view.additional_maps \102 self.assert_([1 for k, f in self.mobile_view.additional_maps 103 103 if k == "modification_date"]) 104 104 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testNewsSitemaps.py
r3163 r3510 47 47 def reParse(self): 48 48 # Parse news sitemap 49 self.sitemap = self.publish("/" + self.portal.absolute_url(1) + \49 self.sitemap = self.publish("/" + self.portal.absolute_url(1) + 50 50 "/news-sitemaps", 51 51 "%s:%s" % (portal_owner, … … 149 149 def reParse(self): 150 150 # Parse news sitemap 151 self.sitemap = self.publish("/" + self.portal.absolute_url(1) + \151 self.sitemap = self.publish("/" + self.portal.absolute_url(1) + 152 152 "/news-sitemaps", 153 153 "%s:%s" % (portal_owner, default_password) … … 213 213 # Now register SchemaExtender adapter and 214 214 # check if it present in Local SiteManger only 215 adapter = "quintagroup.plonegooglesitemaps.newssitemapextender" 215 216 self.assertNotEqual(localsm, globalsm) 216 217 self.assertNotEqual(localsm.queryAdapter( 217 self.my_news, ISchemaExtender,218 name="quintagroup.plonegooglesitemaps.newssitemapextender"),219 None)218 self.my_news, ISchemaExtender, 219 name=adapter), 220 None) 220 221 self.assertEqual(globalsm.queryAdapter( 221 self.my_news, ISchemaExtender,222 name="quintagroup.plonegooglesitemaps.newssitemapextender"),223 None)222 self.my_news, ISchemaExtender, 223 name=adapter), 224 None) 224 225 225 226 … … 270 271 self.assert_(INewsSitemapProvider.providedBy(self.taggable_news)) 271 272 schema = self.taggable_news.Schema().keys() 272 self.assert_("gsm_access" in schema, "no 'gsm_access' in schema: %s" \273 self.assert_("gsm_access" in schema, "no 'gsm_access' in schema: %s" 273 274 % schema) 274 self.assert_("testField" in schema, "no 'testField' in schema: %s" \275 self.assert_("testField" in schema, "no 'testField' in schema: %s" 275 276 % schema) 276 277 … … 306 307 func(self.brain) 307 308 except Exception, e: 308 self.fail("Wrong processing 'Missing' value for '%s': %s" \309 self.fail("Wrong processing 'Missing' value for '%s': %s" 309 310 % (n, str(e))) 310 311 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testPinging.py
r3163 r3510 11 11 def afterSetUp(self): 12 12 super(TestPinging, self).afterSetUp() 13 self.workflow.setChainForPortalTypes( 14 pt_names=('News Item', 'Document'), 15 chain="simple_publication_workflow") 13 workflow = "simple_publication_workflow" 14 self.workflow.setChainForPortalTypes(pt_names=('News Item', 15 'Document'), 16 chain=workflow) 16 17 gsm_properties = 'googlesitemap_properties' 17 18 self.gsm_props = self.portal.portal_properties[gsm_properties] … … 43 44 sys.stdout = back_out 44 45 45 self.assert_('Pinged %s sitemap to Google' \46 self.assert_('Pinged %s sitemap to Google' 46 47 % self.contentSM.absolute_url() in data, 47 48 "Not pinged %s: '%s'" % (self.contentSM.id, data)) 48 self.assert_('Pinged %s sitemap to Google' \49 self.assert_('Pinged %s sitemap to Google' 49 50 % self.newsSM.absolute_url() in data, 50 51 "Not pinged %s: '%s'" % (self.newsSM.id, data)) … … 60 61 sys.stdout = back_out 61 62 62 self.assert_('Pinged %s sitemap to Google' \63 self.assert_('Pinged %s sitemap to Google' 63 64 % self.newsSM.absolute_url() in data, 64 65 "Not pinged %s: '%s'" % (self.newsSM.id, data)) 65 self.assert_(not 'Pinged %s sitemap to Google' \66 self.assert_(not 'Pinged %s sitemap to Google' 66 67 % self.contentSM.absolute_url() in data, 67 68 "Pinged %s on news: '%s'" % (self.contentSM.id, data)) … … 82 83 sys.stdout = back_out 83 84 84 self.assert_('Pinged %s sitemap to Google' \85 self.assert_('Pinged %s sitemap to Google' 85 86 % self.contentSM.absolute_url() in data, 86 87 "Not pinged %s: '%s'" % (self.contentSM.id, data)) 87 self.assert_('Pinged %s sitemap to Google' \88 self.assert_('Pinged %s sitemap to Google' 88 89 % self.newsSM.absolute_url() in data, 89 90 "Not pinged %s: '%s'" % (self.newsSM.id, data)) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testSecurity.py
r3163 r3510 14 14 15 15 def getview(self, vpath): 16 return self.publish("/" + self.portal.absolute_url(1) + \16 return self.publish("/" + self.portal.absolute_url(1) + 17 17 "/" + vpath, self.auth) 18 18 … … 44 44 super(TestSecurityConfigletNotManager, self).afterSetUp() 45 45 self.auth = "mem:mem" 46 self.portal.portal_membership.addMember('mem', 'mem', ('Member',), []) 46 self.portal.portal_membership.addMember('mem', 47 'mem', 48 ('Member',), 49 []) 47 50 48 51 def testConfigOverview(self): … … 59 62 60 63 61 SM_TYPES = { 62 "content": {"id": "sitemap.xml", "types": ("Document",)}, 63 "news": {"id": "news-sitemap.xml", "types": ("News Item",)}, 64 "mobile": {"id": "mobile-sitemap.xml", "types": ("Document",)}, 65 } 64 SM_TYPES = {"content": {"id": "sitemap.xml", "types": ("Document",)}, 65 "news": {"id": "news-sitemap.xml", "types": ("News Item",)}, 66 "mobile": {"id": "mobile-sitemap.xml", "types": ("Document",)}, 67 } 66 68 from DateTime import DateTime 67 69 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testSitemaps.py
r3167 r3510 52 52 53 53 def testAutoSetLayout(self): 54 response = self.publish('/%s/createObject?type_name=Sitemap' \54 response = self.publish('/%s/createObject?type_name=Sitemap' 55 55 % self.portal.absolute_url(1), basic=self.auth) 56 56 location = response.getHeader('location') … … 87 87 wftrans = self.contentSM.getWorkflowTransitions() 88 88 self.assertEqual(isinstance(wftrans, atapi.DisplayList), True) 89 self.assertEqual("simple_publication_workflow#publish" in \89 self.assertEqual("simple_publication_workflow#publish" in 90 90 wftrans.keys(), True) 91 91 … … 95 95 self.contentSM.edit(blackout_list=bolist) 96 96 value = self.contentSM.getBlackout_list() 97 self.assertTrue(value == expect, "Blackout list was not cleaned "\ 98 "up from whitespaces: %s" % str(value)) 97 self.assertTrue(value == expect, "Blackout list was not cleaned " 98 "up from whitespaces: %s" 99 % str(value)) 99 100 100 101 … … 179 180 def afterSetUp(self): 180 181 super(TestPinging, self).afterSetUp() 182 workflow = "simple_publication_workflow" 181 183 self.workflow.setChainForPortalTypes(pt_names=('News Item', 182 'Document'), chain="simple_publication_workflow") 184 'Document'), 185 chain=workflow) 183 186 gsm_properties = 'googlesitemap_properties' 184 187 self.gsm_props = self.portal.portal_properties[gsm_properties] … … 210 213 sys.stdout = back_out 211 214 212 self.assert_('Pinged %s sitemap to Google' \215 self.assert_('Pinged %s sitemap to Google' 213 216 % self.contentSM.absolute_url() in data, 214 217 "Not pinged %s: '%s'" % (self.contentSM.id, data)) 215 self.assert_('Pinged %s sitemap to Google' \218 self.assert_('Pinged %s sitemap to Google' 216 219 % self.newsSM.absolute_url() in data, 217 220 "Not pinged %s: '%s'" % (self.newsSM.id, data)) … … 227 230 sys.stdout = back_out 228 231 229 self.assert_('Pinged %s sitemap to Google' \232 self.assert_('Pinged %s sitemap to Google' 230 233 % self.newsSM.absolute_url() in data, 231 234 "Not pinged %s: '%s'" % (self.newsSM.id, data)) 232 self.assert_(not 'Pinged %s sitemap to Google' \235 self.assert_(not 'Pinged %s sitemap to Google' 233 236 % self.contentSM.absolute_url() in data, 234 237 "Pinged %s on news: '%s'" % (self.contentSM.id, data)) … … 249 252 sys.stdout = back_out 250 253 251 self.assert_('Pinged %s sitemap to Google' \254 self.assert_('Pinged %s sitemap to Google' 252 255 % self.contentSM.absolute_url() in data, 253 256 "Not pinged %s: '%s'" % (self.contentSM.id, data)) 254 self.assert_('Pinged %s sitemap to Google' \257 self.assert_('Pinged %s sitemap to Google' 255 258 % self.newsSM.absolute_url() in data, 256 259 "Not pinged %s: '%s'" % (self.newsSM.id, data)) … … 285 288 filtered = SitemapView(self.sm, TestRequest()).getFilteredObjects() 286 289 self.assertEqual(map(lambda x: x.getPath(), filtered), 287 [self.inner_path, ])290 [self.inner_path, ]) 288 291 289 292 def testNewsSitemap(self): … … 302 305 303 306 307 class TestSitemapDate(TestCase): 308 """ Method dedicated to test index (sitemap_date) in portal_catalog 309 """ 310 def afterSetUp(self): 311 super(TestSitemapDate, self).afterSetUp() 312 313 from time import sleep 314 315 # sequence is important for testing 316 # ("test-folder1", "test-folder2", "index_html") 317 self.folder1 = _createObjectByType("Folder", self.portal, 318 id="test-folder1") 319 320 # create objects with different sitemap_date 321 sleep(1) 322 self.folder2 = _createObjectByType("Folder", self.folder1, 323 id="test-folder2") 324 sleep(1) 325 self.page = _createObjectByType("Document", self.folder2, 326 id="index_html") 327 328 def getCatalogSitemapDate(self, obj): 329 """ Method gets sitemap_date from portal_catalog """ 330 return self.portal.portal_catalog(id=obj.id)[0].sitemap_date 331 332 def getIndexerSitemapDate(self, obj): 333 """ Method gets modification date from 334 function sitemap_date (indexer) 335 """ 336 from quintagroup.plonegooglesitemaps.indexers import sitemap_date 337 338 modification_date = sitemap_date(obj) 339 # you have had to use '__call__' since Plone 3.3 340 if callable(modification_date): 341 modification_date = modification_date() 342 return modification_date 343 344 def testReindexParentObjects(self): 345 """ Method tests handler (reindexParentObjects) """ 346 from quintagroup.plonegooglesitemaps.handlers \ 347 import reindexParentObjects 348 349 # set default page 350 self.folder2.setDefaultPage("index_html") 351 reindexParentObjects(self.page, None) 352 353 self.assertEqual(self.getCatalogSitemapDate(self.page), 354 self.getCatalogSitemapDate(self.folder2)) 355 self.assertNotEqual(self.getCatalogSitemapDate(self.page), 356 self.getCatalogSitemapDate(self.folder1)) 357 358 # set default page 359 self.folder1.setDefaultPage("test-folder2") 360 reindexParentObjects(self.folder2, None) 361 self.assertEqual(self.getCatalogSitemapDate(self.page), 362 self.getCatalogSitemapDate(self.folder1)) 363 364 def testSitemapDateIndexer(self): 365 """ Method tests index (sitemap_date) """ 366 last_date = self.getCatalogSitemapDate(self.folder1) 367 self.assertEqual(last_date, self.getIndexerSitemapDate(self.folder1)) 368 self.folder1.setDefaultPage("test-folder2") 369 self.assertNotEqual(last_date, 370 self.getIndexerSitemapDate(self.folder1)) 371 372 304 373 def test_suite(): 305 374 suite = unittest.TestSuite() … … 308 377 suite.addTest(unittest.makeSuite(TestPinging)) 309 378 suite.addTest(unittest.makeSuite(TestContextSearch)) 379 suite.addTest(unittest.makeSuite(TestSitemapDate)) 310 380 return suite 311 381 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testUpgrade.py
r3163 r3510 42 42 # Test registered upgrade profiles 43 43 pids = [i['id'] for i in self.setup.listProfileInfo()] 44 self.assertEqual("quintagroup.plonegooglesitemaps:upgrade_1_0_to_1_1" \44 self.assertEqual("quintagroup.plonegooglesitemaps:upgrade_1_0_to_1_1" 45 45 in pids, True) 46 self.assertEqual("quintagroup.plonegooglesitemaps:upgrade_1_1_to_1_2" \46 self.assertEqual("quintagroup.plonegooglesitemaps:upgrade_1_1_to_1_2" 47 47 in pids, True) 48 48 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/test_doctest.py
r3163 r3510 28 28 test_class=DocTestCase, globs=globals(), 29 29 optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS), 30 31 30 # | doctest.REPORT_ONLY_FIRST_FAILURE | 31 ]) 32 32 33 33 if __name__ == '__main__': -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/upgrades.py
r3152 r3510 18 18 portal = purl.getPortalObject() 19 19 allCTTypes = types.listContentTypes() 20 obj_metatypes = [m.content_meta_type for m in types.objectValues() \20 obj_metatypes = [m.content_meta_type for m in types.objectValues() 21 21 if m.getId() in allCTTypes] 22 22 convertor = CanonicalConvertor(portal_url=purl()) 23 portal.ZopeFindAndApply( 24 portal, 23 portal.ZopeFindAndApply(portal, 25 24 obj_metatypes=','.join(obj_metatypes), 26 25 apply_func=renameProperty, 27 search_sub=1, 28 ) 26 search_sub=1,) 29 27 print convertor.getLogs() 30 28 -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/utils.py
r3163 r3510 1 1 from urllib2 import urlopen 2 from urllib import quote as urlquote 2 from urllib import quote as urlquote 3 from DateTime import DateTime 3 4 4 5 from Globals import DevelopmentMode 5 6 #from OFS.ObjectManager import BadRequestException 7 from Products.CMFCore.utils import getToolByName 6 8 7 9 from quintagroup.plonegooglesitemaps import config … … 20 22 sitemap_url = urlquote(resurl) 21 23 22 g = urlopen('http://www.google.com/webmasters/tools/ping?sitemap=' + \24 g = urlopen('http://www.google.com/webmasters/tools/ping?sitemap=' + 23 25 sitemap_url) 24 26 g.read() … … 26 28 27 29 return 0 30 31 32 def getDefaultPage(obj): 33 """ Method gets default page for object (folderish) """ 34 plone_tool = getToolByName(obj, 'plone_utils') 35 return plone_tool.getDefaultPage(obj) 36 37 38 def isDefaultPage(obj): 39 """ If object is default page then return True""" 40 plone_tool = getToolByName(obj, 'plone_utils') 41 return plone_tool.isDefaultPage(obj) 42 43 44 def dateTime(obj): 45 """ Method gets modification date """ 46 return DateTime(obj.ModificationDate()) -
quintagroup.plonegooglesitemaps/trunk/setup.py
r3413 r3510 3 3 import os 4 4 5 version = '1. 7.1'5 version = '1.8.0' 6 6 7 7 tests_require = ['zope.testing', … … 10 10 setup(name='quintagroup.plonegooglesitemaps', 11 11 version=version, 12 description="Allows Plone websites to get better visibility for " \12 description="Allows Plone websites to get better visibility for " 13 13 "Google search engine", 14 14 long_description=open("README.txt").read() + "\n" + 15 15 open(os.path.join("docs", "HISTORY.txt")).read(), 16 16 # Get more strings from 17 17 # http://pypi.python.org/pypi?%3Aaction=list_classifiers 18 18 classifiers=[ 19 "Framework :: Plone",20 "Programming Language :: Python",21 19 "Framework :: Plone", 20 "Programming Language :: Python", 21 ], 22 22 keywords='plone google sitemap quintagroup search engine', 23 23 author='Quintagroup', 24 24 author_email='info@quintagroup.com', 25 url='http://svn.quintagroup.com/products/' \25 url='http://svn.quintagroup.com/products/' 26 26 'quintagroup.plonegooglesitemaps', 27 27 license='GPL',
Note: See TracChangeset
for help on using the changeset viewer.