Changeset 1225
- Timestamp:
- 09/08/08 12:47:26
- Files:
-
- qPingTool/branches/plone-3.1/PingTool.py (modified) (5 diffs)
- qPingTool/branches/plone-3.1/adapter.py (deleted)
- qPingTool/branches/plone-3.1/configure.zcml (modified) (1 diff)
- qPingTool/branches/plone-3.1/profiles/default/archetype_tool.xml (deleted)
- qPingTool/branches/plone-3.1/profiles/default/factorytool.xml (deleted)
- qPingTool/branches/plone-3.1/profiles/default/types/PingInfo.xml (modified) (2 diffs)
- qPingTool/branches/plone-3.1/profiles/default/types/PingTool.xml (modified) (1 diff)
- qPingTool/branches/plone-3.1/tests (added)
- qPingTool/branches/plone-3.1/tests/__init__.py (added)
- qPingTool/branches/plone-3.1/tests/base.py (added)
- qPingTool/branches/plone-3.1/tests/framework.py (added)
- qPingTool/branches/plone-3.1/tests/runalltests.py (added)
- qPingTool/branches/plone-3.1/tests/testRegister.py (added)
- qPingTool/branches/plone-3.1/tests/testSkeleton.py (added)
- qPingTool/branches/plone-3.1/tests/test_pinginfo.py (added)
- qPingTool/branches/plone-3.1/tests/test_pingtool.py (added)
- qPingTool/branches/plone-3.1/util.py (deleted)
- qPingTool/branches/plone-3.1/www (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPingTool/branches/plone-3.1/PingTool.py
r1224 r1225 3 3 from Acquisition import aq_base 4 4 5 from zope.interface import implements6 5 from AccessControl import ClassSecurityInfo 7 6 8 7 from Products.Archetypes.public import * 9 8 9 from Products.CMFCore.ActionProviderBase import ActionProviderBase 10 10 from Products.CMFPlone.interfaces.OrderedContainer import IOrderedContainer 11 11 from Products.CMFPlone.PloneFolder import PloneFolder … … 15 15 from Products.CMFCore.permissions import ManagePortal 16 16 from Products.CMFCore.utils import getToolByName 17 from Products.CMFCore.ActionProviderBase import ActionProviderBase18 17 19 18 from Products.ATContentTypes.content.folder import ATFolder … … 21 20 from Products.XMLRPCMethod.XMLRPCMethod import RPCThread, XMLRPCMethod 22 21 23 from util import getCanonicalURL24 22 from zLOG import LOG 25 from config import TOOL_ID,PROJECTNAME23 from config import PROJECTNAME 26 24 27 25 _marker = [] … … 49 47 ) + ATFolder.manage_options 50 48 51 security.declareProtected(ManagePortal, 'manage_overview')52 manage_overview = PageTemplateFile(os.path.join('www','overview'), globals())53 manage_overview.__name__ = 'manage_overview'54 manage_overview._need__name__ = 055 56 def om_icons(self):57 """ Checking on ZMI for canonical_url setting."""58 icons = ({'path':'misc_/qPingTool/tool.gif' \59 ,'alt':self.meta_type \60 ,'title':self.meta_type \61 },)62 if not getCanonicalURL(self):63 icons = icons + ({'path':'misc_/PageTemplates/exclamation.gif' \64 ,'alt':'Error' \65 ,'title':'PingTool needs setting canonical_url' \66 },)67 return icons68 69 49 security.declareProtected(ManagePortal, 'pingFeedReader') 70 50 def pingFeedReader(self,context): 71 51 """ ping """ 72 status = 'success' 73 message = 'The servers are pinged' 74 if context.meta_type == 'BlogFolder': 75 blog = context.simpleblog_tool.getFrontPage(context) 52 status = 'failed' 53 if context.meta_type == 'WeblogEntry': 54 blog = context.getWeblog() 76 55 else: 77 56 blog = context 78 57 79 title = blog.Title() 80 portal = context.portal_url.getPortalObject() 81 canonical_url = getCanonicalURL(context) 82 if canonical_url: 83 url = context.portal_url.getRelativeContentURL(blog) 84 url = canonical_url + url 85 else: 86 return status, 'Ping is impossible.See portal_pingtool.' 58 pingProp = self.getPingProperties(blog) 59 if not pingProp['enable_ping']: 60 message = 'Ping is dissabled.' 61 return status, message 87 62 63 url = blog.absolute_url_path()[1:] 88 64 ps = getToolByName(context,'portal_syndication') 89 65 rss_templates = {'Blog':'','RSS1':'/RSS','RSS2':'/RSS2'} 90 pingProp = self.getPingProperties(blog)91 result = 'ok'92 if not pingProp['enable_ping']:93 message = 'Ping is dissabled'94 return status, message95 66 if ps.isSyndicationAllowed(blog): 67 status = 'success' 68 message = 'The servers are pinged.' 96 69 sites = pingProp['ping_sites'] 97 70 if sites: … … 104 77 PingMethod = XMLRPCMethod('myid',"",site_url,site_method,25) 105 78 blog_url = url + site_rss_version 79 title = blog.Title() 106 80 try: 107 81 #LOG('qPing', 0, title, blog_url, site_url) 108 result = PingMethod(title,blog_url) 82 result_ping = PoingMethod(title,blog_url) 83 result = result_ping['message'] 109 84 except: 110 LOG('qPingTool', 100,"The site "+ site_url+" generated error for "+ blog_url, result) 111 message += '\n'+ str(result) 85 result = 'The site %s generated error for %s.' % (site_url, blog_url) 86 LOG('qPingTool', 100, result) 87 message += '\nReturned message: ' + str(result) 88 else: 89 message = 'The %s is not syndication allowed' % url 112 90 return status, message 113 91 qPingTool/branches/plone-3.1/configure.zcml
r1224 r1225 4 4 i18n_domain="qPingTool"> 5 5 6 <adapter factory=".adapter.CanonicalURL" />7 8 6 <include file="profiles.zcml" /> 9 7 <include file="skins.zcml" /> qPingTool/branches/plone-3.1/profiles/default/types/PingInfo.xml
r1224 r1225 17 17 <property name="allowed_content_types"/> 18 18 <property name="allow_discussion">False</property> 19 20 <alias from="(Default)" to="base_view"/> 21 <alias from="edit" to="base_edit"/> 22 <alias from="index.html" to="(Default)"/> 23 <alias from="properties" to="base_metadata"/> 24 <alias from="view" to="base_view"/> 25 19 26 <action title="View" 20 27 action_id="view" … … 33 40 visible="True" 34 41 i18n:attributes="title"> 35 <permission value=" View"/>42 <permission value="Modify portal content"/> 36 43 </action> 37 44 <action title="Properties" qPingTool/branches/plone-3.1/profiles/default/types/PingTool.xml
r1224 r1225 13 13 <property name="filter_content_types">True</property> 14 14 <property name="allowed_content_types"> 15 <element value="PingInfo"/></property> 15 <element value="PingInfo"/> 16 </property> 16 17 <property name="allow_discussion">False</property> 18 <property name="default_view">base_view</property> 19 <property name="view_methods"> 20 <element value="base_view"/> 21 </property> 22 <property name="default_view_fallback">False</property> 23 17 24 <alias from="(Default)" to="base_view"/> 18 25 <alias from="edit" to="base_edit"/> 19 26 <alias from="index.html" to="(Default)"/> 20 <alias from="properties" to="base_metadata"/>21 27 <alias from="view" to="(Default)"/> 28 22 29 <action title="View" 23 30 action_id="view" 24 31 category="object" 25 32 condition_expr="" 26 url_expr="string: folder_contents"33 url_expr="string:${object_url}/view" 27 34 visible="True" 28 35 i18n:attributes="title"> 29 36 <permission value="Manage portal"/> 30 37 </action> 38 <action title="Edit" 39 action_id="edit" 40 category="object" 41 condition_expr="" 42 url_expr="string:${object_url}/edit" 43 visible="True" 44 i18n:attributes="title"> 45 <permission value="Modify portal content"/> 46 </action> 47 31 48 </object>
