source: products/quintagroup.themetemplate/trunk/quintagroup/themetemplate/__init__.py @ 2111

Last change on this file since 2111 was 1358, checked in by mylan, 15 years ago

Added backward compatibility for pathing theme variables in egg_info/theme_vars.txt file

File size: 1.0 KB
Line 
1#
2import os
3import warnings
4from paste.script import pluginlib
5
6from quintagroup.themetemplate.qplone3_theme import qPlone3Theme
7
8warned = False
9
10def getEggInfo(output_dir):
11    """ Return path to egg info directory, raise error if not found.
12    """
13    egg_info = pluginlib.find_egg_info_dir(output_dir)
14    assert egg_info is not None, "egg_info directory must present for the package"
15
16    return egg_info
17
18
19def getThemeVarsFP(egg_info):
20    """ Return file system path to theme vars configurations
21    """
22    global warned
23    old_path = os.path.join(egg_info, 'theme_vars.txt')
24    if os.path.exists(old_path):
25        if not warned:
26            warnings.warn(
27                "In 1.0 version theme variables from <the.theme.package>/theme_vars.cfg " \
28                "file only will be used. Currently " \
29                "<the.theme.package>/<the.theme.package>.egg_info/theme_vars.txt " \
30                "also supported." , DeprecationWarning, 2)
31            warned = True
32        return old_path
33    return os.path.join(egg_info, '..', 'theme_vars.cfg')
Note: See TracBrowser for help on using the repository browser.