/[pac]/CMFGeographics/Extensions/Install.py
ViewVC logotype

Diff of /CMFGeographics/Extensions/Install.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by tvon, Fri Oct 3 19:36:47 2003 UTC revision 1.9 by tvon, Sat Oct 11 06:01:26 2003 UTC
# Line 1  Line 1 
1  from Products.CMFGeographics.config import *  from Products.CMFGeographics.config import *
2  from Products.CMFGeographics.properties import *  from Products.CMFGeographics.Extensions import Properties
3    
4  from StringIO import StringIO  from StringIO import StringIO
5    
6    country_langs = ('en', 'fr')
7    
8  def install(self):  def install(self):
9      out = StringIO()      out = StringIO()
10            
11      prop_tool = self.portal_properties      self.manage_addProduct['CMFGeographics'].manage_addTool('Geographic Properties Tool', None)
12      if 'geographic_properties' not in prop_tool.objectIds():      self.manage_addProduct['CMFGeographics'].manage_addTool('Geographics Tool', None)
13          prop_tool.manage_addPropertySheet('geographic_properties', 'Geographic Properties')  
14        geo_tool = self.geographic_properties
15      geo_props = prop_tool.geographic_properties  
16        if 'countries' not in geo_tool.objectIds():
17      for item in props:          geo_tool.manage_addPropertySheet('countries', 'Countries')
18          if geo_props.hasProperty(item[0]):  
19              geo_props._updateProperty(item[0], item[1])      country_properties = geo_tool.countries
20    
21        for item in Properties.buildProperties('countries', country_langs, 'country-codes.txt'):
22            if country_properties.hasProperty(item[0]):
23                country_properties._updateProperty(item[0], item[1])
24          else:          else:
25              geo_props._setProperty(item[0], item[1], item[2])              country_properties._setProperty(item[0], item[1], item[2])
26    
27      print >> out, "Successfully installed %s." % PROJECTNAME      print >> out, "Successfully installed %s." % PROJECTNAME
28      return out.getvalue()      return out.getvalue()
29    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26