Changeset 2503 for communesplone/CPComarquage/tags/1.0
- Timestamp:
- 08/26/08 11:22:31 (2 years ago)
- Location:
- communesplone/CPComarquage/tags/1.0
- Files:
-
- 5 edited
-
ConfigurationMethods.py (modified) (5 diffs)
-
Extensions/AppInstall.py (modified) (2 diffs)
-
Extensions/cpcurl.py (modified) (1 diff)
-
config.py (modified) (1 diff)
-
skins/cpcomarquage/cpcomarquage_macros.pt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
communesplone/CPComarquage/tags/1.0/ConfigurationMethods.py
r491 r2503 47 47 get_transaction().commit(1) 48 48 49 50 def updateSubjectsMetadata(self, portal): 49 50 def updateSubjectsMetadata(self, portal): 51 51 """ We add the differents subject from the 'Portail de la Région Wallonne' in the lists of Subject in portal_metadata """ 52 52 #retrieve every subjects from RSS … … 54 54 sin = getToolByName(portal, 'sin_tool') 55 55 rows = sin.sin(map_name=MAPNAME, max_size=MAXRSS) 56 56 57 57 rss_subjects = [] 58 58 for row in rows: 59 59 rss_subjects.append(unicode(row.get('category'), 'latin1').encode('utf-8')) 60 60 61 61 element = meta_tool.getElementSpec('Subject') 62 62 existing_subjects = list(element.getPolicy('Document').allowed_vocabulary) 63 63 64 64 try: 65 65 meta_tool.addElementPolicy(element='Subject', … … 78 78 if subj not in existing_subjects: 79 79 existing_subjects.append(subj) 80 80 81 81 #we sort by alphabetical order 82 82 existing_subjects.sort() … … 99 99 class CPComarquageSetup(SetupWidget): 100 100 type = 'CPComarquage Setup' 101 101 102 102 description = "Permet d'adapter le portail pour l'utilisation du produit CPComarquage" 103 103 104 104 functions = functions 105 105 106 106 single = 0 107 107 … … 121 121 for fn in fns: 122 122 self.functions[fn](self, self.portal) 123 out.append(('Function %s has been applied' % fn, INFO))123 out.append(('Function %s has been applied' % fn, INFO)) 124 124 return out 125 125 -
communesplone/CPComarquage/tags/1.0/Extensions/AppInstall.py
r1320 r2503 31 31 from Products.ExternalMethod.ExternalMethod import manage_addExternalMethod 32 32 from zExceptions import BadRequest 33 from Products.CPComarquage.config import * 33 34 34 35 def install(self): … … 40 41 #if the ExternalMethod already exists, we pass 41 42 pass 42 43 44 try: 45 portal = getToolByName(self, 'portal_url', None).getPortalObject() 46 manage_addExternalMethod(portal, 'cpcdisplayfooter', 'cpcdisplayfooter', 'CPComarquage.cpcurl', 'displayfooter') 47 except: 48 #if the ExternalMethod already exists, we pass 49 pass 50 43 51 #we add the Plone Property Sheet to portal_properties 44 52 self.portal_properties.addPropertySheet('cpcomarquage_properties', 'CPComarquage Properties', propertysheet=None) 45 53 46 54 #we add the properties to the Property Sheet 47 55 self.portal_properties.cpcomarquage_properties.manage_addProperty('absolute_urls', True, 'boolean') 48 56 self.portal_properties.cpcomarquage_properties.manage_addProperty('full_replace', True, 'boolean') 49 57 58 #add the "wal" channel in CMFSin, updated every 7 days... 59 #period and frequency are passed as kwargs 60 self.sin_tool.addChannel(CHANNELNAME, CHANNELURL, period='d', frequency=7) 61 self.sin_tool.addMap(MAPNAME, channels = [CHANNELNAME, ]) 62 self.sin_tool.sin(MAPNAME) 63 64 #update Subject metadata for Content type 'Page' 65 from Products.CPComarquage.ConfigurationMethods import updateSubjectsMetadata 66 updateSubjectsMetadata(self, self) 67 50 68 def uninstall(self): 51 """ Uni stall method for CPComarquage """69 """ Uninstall method for CPComarquage """ 52 70 try: 53 71 #we remove the added property sheet -
communesplone/CPComarquage/tags/1.0/Extensions/cpcurl.py
r1160 r2503 38 38 except IOError: 39 39 return None 40 40 41 41 data = f.read() 42 42 f.close() 43 43 return data 44 45 def displayfooter(self, rows, sujet): 46 lst = [] 47 for row in rows: 48 lst.append(row['category']) 49 50 for s in sujet: 51 if s in lst: 52 return True 53 54 return False -
communesplone/CPComarquage/tags/1.0/config.py
r1319 r2503 70 70 ##code-section config-bottom #fill in your manual code here 71 71 #the name of the map for CMFSin 72 CHANNELNAME = "wal" 73 CHANNELURL = "http://www.wallonie.be/fr/comarquage.rss" 72 74 MAPNAME = "wal" 73 75 #the maximum of lines we want to read in the RSS -
communesplone/CPComarquage/tags/1.0/skins/cpcomarquage/cpcomarquage_macros.pt
r1556 r2503 16 16 display_header python:1; 17 17 display_footer python:0; 18 rows python:sin.sin(map, max_size=max);"> 18 rows python:sin.sin(map, max_size=max); 19 display_footer python: context.cpcdisplayfooter(rows, sujet)" 20 tal:condition="display_footer" > 19 21 20 22 <div class="cpcomarquageHeader">Retrouvez ici les informations émanant du portail de la Région Wallonne</div> 21 22 23 <table class="cpcomarquageTable"> 23 24 <tal:repeat tal:repeat="row rows">
Note: See TracChangeset
for help on using the changeset viewer.
