Public Member Functions | Public Attributes | List of all members
PageConfig.PageConfig Class Reference

Public Member Functions

def __init__ (self, cfgFileName)
 

Public Attributes

 pageFileName
 
 pageTitle
 
 pageDesc
 
 maxCacheLifetime
 
 chains
 

Detailed Description

Definition at line 6 of file PageConfig.py.

Constructor & Destructor Documentation

def PageConfig.PageConfig.__init__ (   self,
  cfgFileName 
)

Definition at line 7 of file PageConfig.py.

References open().

7  def __init__(self,cfgFileName):
8  cfgFile=os.path.expandvars(cfgFileName)
9  if not os.path.isfile(cfgFile):
10  sys.stderr.write("ERROR!! Could not open %s\n" %cfgFile)
11  sys.exit(-1)
12 
13  mainDefaults={}
14  #max cache lifetime in seconds
15  mainDefaults['include_directory']="./"
16  mainDefaults['includes']=""
17  cfg=SafeConfigParser()
18  cfg.readfp(open(cfgFile))
19 
20  self.pageFileName = cfg.get("main","page_name")
21  self.pageTitle = cfg.get("main","page_title")
22  self.pageDesc = cfg.get("main","description").replace("\n"," ")
23 
24 
25  self.maxCacheLifetime = 604800 #units in seconds
26  if "max_cache_lifetime" in cfg.options("main"):
27  self.maxCacheLifetime = int(cfg.get("main","max_cache_lifetime"))
28 
29  includeDir=""
30  if "include_directory" in cfg.options("main"):
31  includeDir=cfg.get("main","include_directory")
32 
33  includes=""
34  if "includes" in cfg.options("main"):
35  includes=cfg.get("main","includes")
36 
37  for include in includes.split():
38  include=include.strip()
39  fullInclude=os.path.expandvars(includeDir + "/" + include)
40  cfg.readfp(open(fullInclude))
41 
42 
43  self.chains=[]
44  for section in cfg.sections():
45  if not section.startswith("chain") : continue
46  chain=makeChain(section,cfg)
47  self.chains.append(chain)
48 
49 
def makeChain(chainSection, cfg)
Definition: ChainData.py:69
procfile open("FD_BRL_v0.txt")
def __init__(self, cfgFileName)
Definition: PageConfig.py:7

Member Data Documentation

PageConfig.PageConfig.chains

Definition at line 43 of file PageConfig.py.

PageConfig.PageConfig.maxCacheLifetime

Definition at line 25 of file PageConfig.py.

PageConfig.PageConfig.pageDesc

Definition at line 22 of file PageConfig.py.

PageConfig.PageConfig.pageFileName

Definition at line 20 of file PageConfig.py.

Referenced by PageMaker.PageMaker.write().

PageConfig.PageConfig.pageTitle

Definition at line 21 of file PageConfig.py.


The documentation for this class was generated from the following file: