Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ExternalEditor.zopeedit.Configuration Class Reference

List of all members.

Public Member Functions

def __init__
def save
def set
def __getattr__
def getAllOptions

Public Attributes

 path
 changed
 config

Detailed Description

Definition at line 48 of file zopeedit.py.


Constructor & Destructor Documentation

Definition at line 50 of file zopeedit.py.

00050 
00051     def __init__(self, path):
00052         # Create/read config file on instantiation
00053         self.path = path
00054         if not os.path.exists(path):
00055             f = open(path, 'w')
00056             f.write(default_configuration)
00057             f.close()
00058         self.changed = 0
00059         self.config = ConfigParser()
00060         self.config.readfp(open(path))
            

Member Function Documentation

Definition at line 70 of file zopeedit.py.

00070 
00071     def __getattr__(self, name):
00072         # Delegate to the ConfigParser instance
00073         return getattr(self.config, name)
        

Here is the caller graph for this function:

def ExternalEditor.zopeedit.Configuration.getAllOptions (   self,
  meta_type,
  content_type,
  host_domain 
)
Return a dict of all applicable options for the
   given meta_type, content_type and host_domain

Definition at line 74 of file zopeedit.py.

00074 
00075     def getAllOptions(self, meta_type, content_type, host_domain):
00076         """Return a dict of all applicable options for the
00077            given meta_type, content_type and host_domain
00078         """
00079         opt = {}
00080         sep = content_type.find('/')
00081         general_type = '%s/*' % content_type[:sep]
00082         
00083         # Divide up the domains segments and create a
00084         # list of domains from the bottom up
00085         host_domain = host_domain.split('.')
00086         domains = []
00087         for i in range(len(host_domain)):
00088             domains.append('domain:%s' % '.'.join(host_domain[i:]))
00089         domains.reverse()
00090 
00091         sections = ['general']
00092         sections.extend(domains)
00093         sections.append('meta-type:%s' % meta_type)
00094         sections.append('content-type:%s' % general_type)
00095         sections.append('content-type:%s' % content_type)
00096         
00097         for section in sections:
00098             if self.config.has_section(section):
00099                 for option in self.config.options(section):
00100                     opt[option] = self.config.get(section, option)
00101         return opt
        
Save config options to disk

Definition at line 61 of file zopeedit.py.

00061 
00062     def save(self):
00063         """Save config options to disk"""
00064         self.config.write(open(self.path, 'w'))
00065         self.changed = 0
            
def ExternalEditor.zopeedit.Configuration.set (   self,
  section,
  option,
  value 
)

Definition at line 66 of file zopeedit.py.

00066 
00067     def set(self, section, option, value):
00068         self.config.set(section, option, value)
00069         self.changed = 1
    

Here is the caller graph for this function:


Member Data Documentation

Definition at line 57 of file zopeedit.py.

Definition at line 58 of file zopeedit.py.

Definition at line 52 of file zopeedit.py.


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