Changeset 1357 in products for quintagroup.themetemplate/trunk/quintagroup/themetemplate/__init__.py
- Timestamp:
- Nov 1, 2009 11:07:11 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.themetemplate/trunk/quintagroup/themetemplate/__init__.py
r1005 r1357 1 1 # 2 import os,types 3 from StringIO import StringIO 4 from ConfigParser import SafeConfigParser 2 import os 3 from paste.script import pluginlib 5 4 6 5 from quintagroup.themetemplate.qplone3_theme import qPlone3Theme 7 6 8 def write_map(cmd, basename, filename, force=False): 9 argname = os.path.splitext(basename)[0] 10 value = getattr(cmd.distribution, argname, None) 7 def getEggInfo(output_dir): 8 """ Return path to egg info directory, raise error if not found. 9 """ 10 egg_info = pluginlib.find_egg_info_dir(output_dir) 11 assert egg_info is not None, "egg_info directory must present for the package" 11 12 12 if value: 13 config = SafeConfigParser() 14 config.add_section('qplone3_theme') 15 for name, val in value.items(): 16 val = val and str(val) or '' 17 config.set('qplone3_theme', name, val) 18 19 strvalue = StringIO() 20 config.write(strvalue) 21 value = strvalue.getvalue() 22 23 cmd.write_or_delete_file(argname, filename, value, force) 13 return egg_info 24 14 25 15 26 def assert_dict(dist, attr, value): 27 """Verify that value is a dict or None""" 28 try: 29 assert type(value) == types.DictType 30 except (TypeError,ValueError,AttributeError,AssertionError): 31 raise DistutilsSetupError( 32 "%r must be a dict (got %r)" % (attr,value) 33 ) 16 def getThemeVarsFP(egg_info): 17 """ Return file system path to theme vars configurations 18 """ 19 return os.path.join(egg_info, '..', 'theme_vars.cfg')
Note: See TracChangeset
for help on using the changeset viewer.