-í
›KX;c       s/  d  Z  d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z	 d k
 l Z d k Z d Z d e i f d „  ƒ  YZ e i d ƒ Z e i e d „ Z d f  d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e i e i e e d „ Z e i e i e e d „ Z d e f d „  ƒ  YZ e Z e Z  d e f d „  ƒ  YZ! e! Z" e! Z# d e f d „  ƒ  YZ$ d e! f d „  ƒ  YZ% d e f d „  ƒ  YZ& d e f d „  ƒ  YZ' d  e f d! „  ƒ  YZ( d" e f d# „  ƒ  YZ) d$ e' f d% „  ƒ  YZ* d& e& f d' „  ƒ  YZ+ d( e' f d) „  ƒ  YZ, d* e& f d+ „  ƒ  YZ- d, e* f d- „  ƒ  YZ. d. e f d/ „  ƒ  YZ/ d0 e/ f d1 „  ƒ  YZ0 d2 e0 f d3 „  ƒ  YZ1 d4 e f d5 „  ƒ  YZ2 d6 e f d7 „  ƒ  YZ3 d8 e f d9 „  ƒ  YZ4 d: e f d; „  ƒ  YZ5 d< e f d= „  ƒ  YZ6 d> e f d? „  ƒ  YZ7 d@ e f dA „  ƒ  YZ8 dB e f dC „  ƒ  YZ9 dD e i f dE „  ƒ  YZ: dF e: f dG „  ƒ  YZ; e i dH ƒ Z< e i dI ƒ Z= dJ f  dK „  ƒ  YZ> e? dL j oQ dM e: f dN „  ƒ  YZ@ dO ZA d kB ZB eB iC eA ƒ ZD e> e@ ƒ ZE eE iF eD ƒ n d S(P   së	   ConfigFile -- Interface to simple template based configuration files.

    The format of these files is as follows:

    globalvar = 2

    [ABC]
    a = 1
    b = abc.html
    c = text with spaces

    [DEF]
    a = 2
    b = a + 3
    c = a string

    Entries in square brackets indicate new subsections. Global
    variables may be set prior to starting any subsection. Emtpy lines
    and lines starting with '#' (comments) are ignored. Indentation is
    not necessary; lines can start at any column.

    Entries may span multiple lines by using '' continuations
    at the line ends, e.g.

    [Continuation]
    a = first line        second line

    The lines are stripped of any white space before removing the
    trailing '' and concatenating them. Comment lines are removed as
    well.

    To parse these files, a template in form of a class including
    subclasses (identifying the subsections) must be given to the
    reader. This template defines which sections and attributes are
    known. All others are rejected.  A sample template for the above
    looks like this:

    from mx.Misc.ConfigFile import *
    class Template(ConfigNamespace):

        global = IntegerEntry()

        class ABC(ConfigSection):
            a = IntegerEntry('0')
            b = StringEntry('default.html')
            c = StringEntry()

        class DEF(ConfigSection):
            a = IntegerEntry('0')
            b = EvalEntry('0')
            c = StringEntry('default value')

    The main class representing the global namespace of the ini file
    must have ConfigNamespace as baseclass. It may contain any number
    of ConfigSection subclasses each defining parsed attributes. 

    The ini file may only contain entries defined in this template.
    In case an unkown section is found, the main class is looked up
    for a ConfigSection subclass with name 'DefaultSection'. This
    section object is then taken as template for a new section
    of the given name.

    The same feature is available for attributes in sections. In case
    a given attribute is not found in the templates, the section's
    'DefaultAttribute' attribute is deepcopied and the used as
    attribute template.

    Needs mxTools to be installed.

    XXX Add support for long strings (including embedded control
        characters and spanning multiple lines)

    Copyright (c) 2000, Marc-Andre Lemburg; All Rights Reserved.
    See the documentation for further information on copyrights,
    or contact the author. All Rights Reserved.

N(   s   freezei    s   Errorc      s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ErrorY s   s"   (?:\$([a-zA-Z0-9._]+)|\${([^}]*)})c    sˆ  x}d ou| i |  ƒ }	 |	 o Pn |	 i ƒ  } | | d p | d d ƒ } | d } | i
 | t ƒ } | t j o< | i
 | t ƒ } | t j o t i i
 | d ƒ } n n xH | d D]< } y t | | ƒ } Wn  t j
 o t d | ‚ n XqÀ W|	 i ƒ  \ }
 } t | t ƒ o= | } | i t j o | i | i | | ƒ n | i } n |  |
  t | ƒ |  | }  q W|  Sd S(   sú    Expands all variables of the form $var or ${var} using
        the dictionaries locals,globals,os.environ in that order
        as database.

        Default value is the empty string, just like for shell
        environment variables.
        
    i   i    s   .s    s   attribute "%s" undefinedN(   s	   shell_vars   searchs   texts   ms   groupss   gs   splits   varpaths   varnames   localss   gets   Nones   values   globalss   oss   environs   attrs   getattrs   AttributeErrors   Errors   spans   ls   rs
   isinstances   Entrys   entrys   NotGivens   parses   defaults   str(   s   texts   localss   globalss   splits	   shell_vars   varpaths   attrs   gs   varnames   ms   ls   values   rs   entry(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   expand_vars` s8      
 !s   Entryc      sb   t  Z d  Z e Z d Z e e e f Z	 e d „ Z
 d „  Z e i e d „ Z d „  Z d „  Z RS(   sÙ    Converts the value to another datatype depending on the
        .converters attribute.

        Each of those functions is applied to the value. The first one
        to not raise an exception succeeds.
        
    s    c    s   | t j	 o | |  _  n d  S(   N(   s   defaults   NotGivens   self(   s   selfs   default(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   __init__Ÿ s    c    sŠ   |  i t | ƒ | | ƒ } xB |  i D]1 } y | | ƒ } PWn t	 i
 ƒ  d } n Xq% W| ‚ t } |  i | | | ƒ |  _ } | Sd S(   s¬    Parse text according to the namespace dictionaries
            locals and globals.

            Sets self.value and returns the parsed value as well.
            
        i   N(   s   selfs   pre_processs   strs   texts   localss   globalss
   converterss	   converters   values   syss   exc_infos   lastexcs   Nones   post_process(   s   selfs   texts   localss   globalss   values	   converters   lastexc(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   parse¤ s     
 c    s   | | | ƒ | | ƒ Sd S(   sˆ    Preprocess the text value.

            Default behaviour is to strip the text and then
            apply variable expansion.

        N(   s   expand_varss   strips   texts   localss   globals(   s   selfs   texts   localss   globalss   strips   expand_vars(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   pre_processº s    	 c    s   | Sd S(   sŠ    Postprocess the value after conversion has been
            applied.

            The default behaviour is to leave it as it is.
        N(   s   value(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processÆ s     c    s;   |  i t j o |  i |  i h  h  ƒ n t |  i ƒ Sd S(   sŽ    Return a stringified version of self.value.

            The default value is parsed in case no value has yet been
            set.

        N(   s   selfs   values   NotGivens   parses   defaults   str(   s   self(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   __str__Ï s     (   s   __name__s
   __module__s   __doc__s   NotGivens   values   defaults   ints   floats   strs
   converterss   __init__s   parses   strings   strips   expand_varss   pre_processs   post_processs   __str__(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   Entry‹ s    			s   IntegerEntryc      s   t  Z d  Z e f Z RS(   s'    Converts the value to an integer.
    (   s   __name__s
   __module__s   __doc__s   ints
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   IntegerEntryÝ s    s
   FloatEntryc      s   t  Z d  Z e f Z RS(   s$    Converts the value to a float.
    (   s   __name__s
   __module__s   __doc__s   floats
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys
   FloatEntryã s    s   NumericEntryc      s   t  Z d  Z e e f Z RS(   s8    Converts the value to a number (integer or float).
    (   s   __name__s
   __module__s   __doc__s   ints   floats
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   NumericEntryé s    s   StringEntryc      s   t  Z d  Z e f Z RS(   s%    Converts the value to a string.
    (   s   __name__s
   __module__s   __doc__s   strs
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   StringEntryï s    c    s   | | | |  d ƒ ƒ Sd  S(   Ns   ,(   s   maps   strips   splits   text(   s   texts   strips   splits   maps   tuple(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys
   comma_listõ s    c    s   | | | |  ƒ ƒ Sd  S(   N(   s   maps   strips   splits   text(   s   texts   strips   splits   maps   tuple(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   spaced_listû s    s
   TupleEntryc      s    t  Z d  Z e f Z d „  Z RS(   sÛ    Converts the value to a tuple of strings.

        value must be a string with entries separated by ','. Entries
        are split at each occurance of ',' and then stripped of
        surrounding spaces.
        
    c    s   t  | ƒ Sd  S(   N(   s   tuples   value(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processs    (   s   __name__s
   __module__s   __doc__s
   comma_lists
   converterss   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys
   TupleEntrys    	s	   ListEntryc      s   t  Z d  Z e f Z RS(   sÚ    Converts the value to a list of strings.

        value must be a string with entries separated by ','. Entries
        are split at each occurance of ',' and then stripped of
        surrounding spaces.
        
    (   s   __name__s
   __module__s   __doc__s
   comma_lists
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys	   ListEntrys    s   SpacedTupleEntryc      s   t  Z d  Z e f Z RS(   sØ    Converts the value to a tuple of strings.

        value must be a string with entries separated by
        whitespace. Entries are split at each occurance of whitespace;
        surrounding spaces is removed.

    (   s   __name__s
   __module__s   __doc__s   spaced_lists
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   SpacedTupleEntry#s    s   SpacedListEntryc      s   t  Z d  Z e f Z RS(   s×    Converts the value to a list of strings.

        value must be a string with entries separated by
        whitespace. Entries are split at each occurance of whitespace;
        surrounding spaces is removed.

    (   s   __name__s
   __module__s   __doc__s   spaced_lists
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   SpacedListEntry.s    s	   FileEntryc      s   t  Z d  Z e f Z RS(   s!    Entry field for an OS file.
    (   s   __name__s
   __module__s   __doc__s   strs
   converters(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys	   FileEntry9s    s	   PathEntryc      s    t  Z d  Z e f Z d „  Z RS(   sV    Entry field for an OS path.

        Paths will always end with os.sep if given.
    c    s4   | o | d t i j o | t i } n | Sd  S(   Niÿÿÿÿ(   s   values   oss   sep(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processGs    (   s   __name__s
   __module__s   __doc__s   strs
   converterss   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys	   PathEntry?s    	s   AbsoluteFileEntryc      s    t  Z d  Z e f Z d „  Z RS(   sm    Entry field for an absolute OS pathname.

        The pathname will always start with os.sep if given.

    c    s4   | o | d t i j o t i | } n | Sd  S(   Ni    (   s   values   oss   sep(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processVs    (   s   __name__s
   __module__s   __doc__s   strs
   converterss   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   AbsoluteFileEntryMs    	s   AbsolutePathEntryc      s    t  Z d  Z e f Z d „  Z RS(   sq    Entry field for an absolute OS path.

        The pathname will always start and end with os.sep if given.

    c    s]   | oN | d t i j o t i | } n | d t i j o | t i } n n | Sd  S(   Ni    iÿÿÿÿ(   s   values   oss   sep(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processes    (   s   __name__s
   __module__s   __doc__s   strs
   converterss   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   AbsolutePathEntry\s    	s   RelativePathEntryc      s#   t  Z d  Z e d „ Z d „  Z RS(   sÔ    Entry field for relative paths.
    
        The path stored is the result of joining the given parameter
        with a basepath. basepath is subject to variable expansion at
        parsing time.
        
    c    s   | |  _  t i |  | ƒ d  S(   N(   s   basepaths   selfs	   PathEntrys   __init__s   default(   s   selfs   basepaths   default(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   __init__ws    	c    s&   t  i i t |  i | | ƒ | ƒ Sd  S(   N(	   s   oss   paths   joins   expand_varss   selfs   basepaths   localss   globalss   value(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_process|s    (   s   __name__s
   __module__s   __doc__s   NotGivens   __init__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   RelativePathEntryns    s   RelativeFileEntryc      s#   t  Z d  Z e d „ Z d „  Z RS(   sá    Entry field for relative pathnames to files.
    
        The path stored is the result of joining the given parameter
        with a basepath. basepath is subject to variable expansion at
        parsing time.
        
    c    s   | |  _  t i |  | ƒ d  S(   N(   s   basepaths   selfs	   PathEntrys   __init__s   default(   s   selfs   basepaths   default(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   __init__‰s    	c    s&   t  i i t |  i | | ƒ | ƒ Sd  S(   N(	   s   oss   paths   joins   expand_varss   selfs   basepaths   localss   globalss   value(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processŽs    (   s   __name__s
   __module__s   __doc__s   NotGivens   __init__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   RelativeFileEntry€s    s   ExistingPathEntryc      s   t  Z d  Z d „  Z RS(   sl    Checks value to point to an existing OS path.

        Raises an exception if the path does not exist.
    c    sY   | o | d t i j o | t i } n t i i | ƒ o t d | ‚ n | Sd  S(   Niÿÿÿÿs   non existing path "%s"(   s   values   oss   seps   paths   existss   Error(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_process˜s
    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ExistingPathEntry’s    s   ExistingFileEntryc      s   t  Z d  Z d „  Z RS(   si    Checks value to point to an existing file.

        Raises an exception if the file does not exist.
    c    s5   | p t i i | ƒ o t d | ‚ n | Sd  S(   Ns   non existing file "%s"(   s   values   oss   paths   existss   Error(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_process¦s    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ExistingFileEntry s    s   ExistingRelativePathEntryc      s   t  Z d  Z d „  Z RS(   sÊ    Entry field for relative paths.
    
        The path stored is the result of joining the given parameter
        with a basepath.  Raises an exception if the path does not
        exist.
        
    c    sQ   t  i i t |  i | | ƒ | ƒ } t  i i	 | ƒ o t
 d | ‚ n | Sd  S(   Ns   non existing path "%s"(   s   oss   paths   joins   expand_varss   selfs   basepaths   localss   globalss   values   existss   Error(   s   selfs   values   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processµs    $(   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ExistingRelativePathEntry¬s    s   URLEntryc      s   t  Z d  Z d „  Z RS(   s    Entry field for URLs.

        The field takes a default value as argument. 

        Needs mxHTMLTools to be installed.

    c    s   d k  l } | i | ƒ Sd  S(   N(   s	   HTMLTools(   s   mxs	   HTMLToolss   URLs   value(   s   selfs   values   localss   globalss	   HTMLTools(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processÅs    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   URLEntry¼s    s   RelativeURLEntryc      s&   t  Z d  Z d e d „ Z d „  Z RS(   sÌ    Entry field for relative URLs.

        A base URL can be set which is then urljoined with the
        value given. The field also takes a default value.

        Needs mxHTMLTools to be installed.

    s    c    s   | |  _  t i |  | ƒ d  S(   N(   s   baseurls   selfs   StringEntrys   __init__s   default(   s   selfs   baseurls   default(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   __init__Ôs    	c    s0   d k  l } | i t |  i | | ƒ | ƒ Sd  S(   N(   s	   HTMLTools(	   s   mxs	   HTMLToolss   urljoins   expand_varss   selfs   baseurls   localss   globalss   value(   s   selfs   values   localss   globalss	   HTMLTools(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processÙs    (   s   __name__s
   __module__s   __doc__s   NotGivens   __init__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   RelativeURLEntryÊs   	 s   AbsoluteURLEntryc      s   t  Z d  Z d „  Z RS(   sº    Entry field for absolute URLs.

        A base URL can be set which is then urljoined with the
        value given. The field also takes a default value as second
        argument.
    c    s<   t  i |  | | | ƒ } | i o t d | ‚ n | Sd  S(   Ns   need an absolute URL: "%s"(	   s   RelativeURLEntrys   post_processs   selfs   values   localss   globalss   urls   absolutes   Error(   s   selfs   values   localss   globalss   url(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processçs    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   AbsoluteURLEntryßs    s	   DateEntryc      s   t  Z d  Z d „  Z RS(   s›    Date entry field.

        The value is stored using a DateTime instance. A time part is
        ignored.

        Needs mxDateTime to be installed.

    c    s   d k  l } | | ƒ Sd  S(   N(   s   DateFromString(   s   mx.DateTime.Parsers   DateFromStrings   value(   s   selfs   values   localss   globalss   DateFromString(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processøs    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys	   DateEntryîs   	 s   DateTimeEntryc      s   t  Z d  Z d „  Z RS(   s€    Date/time entry field.

        The value is stored using a DateTime instance.

        Needs mxDateTime to be installed.

    c    s   d k  l } | | ƒ Sd  S(   N(   s   DateTimeFromString(   s   mx.DateTime.Parsers   DateTimeFromStrings   value(   s   selfs   values   localss   globalss   DateTimeFromString(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processs    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   DateTimeEntryýs    s	   TimeEntryc      s   t  Z d  Z d „  Z RS(   s     Time entry field.

        The value is stored using a DateTimeDelta instance. A date
        part is ignored.

        Needs mxDateTime to be installed.

    c    s   d k  l } | | ƒ Sd  S(   N(   s   TimeFromString(   s   mx.DateTime.Parsers   TimeFromStrings   value(   s   selfs   values   localss   globalss   TimeFromString(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_processs    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys	   TimeEntrys   	 s   DateTimeDeltaEntryc      s   t  Z d  Z d „  Z RS(   s‹    Date/time delta entry field.

        The value is stored using a DateTimeDelta instance.

        Needs mxDateTime to be installed.

    c    s   d k  l } | | ƒ Sd  S(   N(   s   DateTimeDeltaFromString(   s   mx.DateTime.Parsers   DateTimeDeltaFromStrings   value(   s   selfs   values   localss   globalss   DateTimeDeltaFromString(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_process#s    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   DateTimeDeltaEntrys    s   RelativeDateTimeEntryc      s   t  Z d  Z d „  Z RS(   s‘    Relative date/time entry field.

        The value is stored using a RelativeDateTime instance.

        Needs mxDateTime to be installed.

    c    s   d k  l } | | ƒ Sd  S(   N(   s   RelativeDateTimeFromString(   s   mx.DateTime.Parsers   RelativeDateTimeFromStrings   value(   s   selfs   values   localss   globalss   RelativeDateTimeFromString(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   post_process1s    (   s   __name__s
   __module__s   __doc__s   post_process(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   RelativeDateTimeEntry(s    s	   EvalEntryc      s   t  Z d  Z e d „ Z RS(   s     Allows simple calculations to be done using the
        current locals (the symbols defined in the class
        where the entry is located) and globals.

    c    s    | | | | ƒ |  _ |  i Sd  S(   N(   s   evals   texts   localss   globalss   selfs   value(   s   selfs   texts   localss   globalss   eval(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   parse=s    (   s   __name__s
   __module__s   __doc__s   evals   parse(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys	   EvalEntry6s    s   SafeEvalEntryc      s   t  Z d  Z e d „ Z RS(   sÅ    Allows simple calculations to be done using the
        current locals (the symbols defined in the class
        where the entry is located) and globals.

        Builtins are not available.

    c    s    | | | | ƒ |  _ |  i Sd  S(   N(   s   revals   texts   localss   globalss   selfs   value(   s   selfs   texts   localss   globalss   reval(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   parseMs    (   s   __name__s
   __module__s   __doc__s   revals   parse(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   SafeEvalEntryDs    s	   DictEntryc      s   t  Z d  Z d „  Z RS(   s±   Allows the construction of a Python dictionary.

        The entries value is taken as list of key: value pairs which
        are evaluated in the current locals (the symbols defined in
        the class where the entry is located) and globals.

        Parsing is left to the Python interpreter. The needed curly
        brackets {} are added by the parsing method.

        Sample:

        dict = 'a': (1,2,3), 'b': (3,4,5)

    c    s(   t  d | d | | ƒ |  _ |  i Sd  S(   Ns   {s   }(   s   evals   texts   localss   globalss   selfs   value(   s   selfs   texts   localss   globals(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   parseds    (   s   __name__s
   __module__s   __doc__s   parse(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys	   DictEntryTs    s   ConfigNamespacec      sŒ   t  Z e Z e Z e e i e i e i	 e i
 f e i e i e i e i e i f e i e i d „ Z d „  Z d „  Z d „  Z d „  Z RS(   Nc    s  |  i } t | ƒ |  i } | i | i ƒ xì | i ƒ  D]Þ \ } } | d  d j o | | =n t
 | ƒ }	 |	 | j o2 | d j o t | t ƒ o | ƒ  | | <n nl |	 | j o | | =nT |	 | j o nC y | | ƒ | | <Wn+ t i j
 o }
 t d | |
 f ‚ n Xq9 Wd  S(   Ni   s   _ s   DefaultSections,   namespace entry "%s" could not be copied: %s(   s   selfs	   __class__s   classobjs   freezes   __dict__s   dicts   updates   itemss   names   objs   types   objtypes	   ClassTypes
   issubclasss   ConfigSections	   del_typess
   skip_typess   deepcopys   copys   errors   whys   Error(   s   selfs   getattrs
   skip_typess	   del_typess   deepcopys	   ClassTypes   objs   names   classobjs   objtypes   whys   dict(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   __init__xs(    	
	 c    su   g  } | i } x[ |  i i  ƒ  D]J \ } } | d  d j p | d d d f j o q n | | | f ƒ q W| Sd  S(   Ni   s   _s   DefaultSections   DefaultAttributes   baseobj(   s   itemss   appends   selfs   __dict__s   ks   v(   s   selfs   itemss   ks   appends   v(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   _items³s    	 'c    so   g  } | i } xU |  i i  ƒ  D]D \ } } | d  d j p | d d d f j o q n | | ƒ q W| Sd  S(   Ni   s   _s   DefaultSections   DefaultAttributes   baseobj(   s   itemss   appends   selfs   __dict__s   ks   v(   s   selfs   itemss   ks   appends   v(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   _keys¾s    	 'c    so   g  } | i } xU |  i i  ƒ  D]D \ } } | d  d j p | d d d f j o q n | | ƒ q W| Sd  S(   Ni   s   _s   DefaultSections   DefaultAttributes   baseobj(   s   itemss   appends   selfs   __dict__s   ks   v(   s   selfs   itemss   ks   appends   v(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   _valuesÉs    	 'c    sg   h  } | i |  i ƒ xF | i ƒ  D]8 } | d  d j p | d d d f j o | | =n q# W| Sd  S(   Ni   s   _s   DefaultSections   DefaultAttributes   baseobj(   s   ds   updates   selfs   __dict__s   keyss   k(   s   selfs   ks   d(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   _dictionaryÔs     '(   s   __name__s
   __module__s   Nones   DefaultSections   DefaultAttributes   getattrs   typess
   ModuleTypes   IntTypes
   StringTypes   NoneTypes   FunctionTypes   UnboundMethodTypes
   MethodTypes   BuiltinFunctionTypes   BuiltinMethodTypes   copys   deepcopys	   ClassTypes   __init__s   _itemss   _keyss   _valuess   _dictionary(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ConfigNamespaceks   T;			s   ConfigSectionc      s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ConfigSectionßs   s   \[([a-zA-Z_][a-zA-Z_0-9]*)\]s'   ([a-zA-Z_][a-zA-Z_0-9]*)[ 	]*=[ 	]*(.*)s
   ConfigFilec      sM   t  Z d  Z e Z d „  Z e i e i	 e i
 d „ Z e i e i d „ Z RS(   s?   Configuration file reader.

        Takes a template (a ConfigNamespace subclass) as input which
        defines sections using classes. Sections may include instances
        of Entry as attributes. These are then used to process the
        file input.

        The template is (deep-)copied and placed into the instance
        variable .data (a ConfigNamespace instance) prior to reading
        the file. Section classes are replaced with ConfigSection
        instances.

        After successful reading the file, the configuration
        information is available through this variable.

        Errors are indicated by exceptions of type Error. These always
        have values (line_number, explanation) where line_number is 0
        for errors which do not refer to one specific line in the
        file.
        
    c    s   | |  _  |  i ƒ  d  S(   N(   s   templates   selfs   reset(   s   selfs   template(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   __init__ s    	c    s   |  i ƒ  |  _ d S(   sq    Reset the object to its initial state.

            This initializes self.data to a template instance.

        N(   s   selfs   templates   data(   s   selfs   deepcopys	   ClassTypes
   ModuleType(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   resets    	 c  	  sØ  h  } d } |  i }	 |	 } |	 i } | }
 d } t	 o	 d GHn xd oû| i ƒ  } | d } | o Pn | | ƒ } | p | d d j o qC n t	 o d t | ƒ GHn | } x¦ | d d j o” | i ƒ  } | d } | o | d  } Pn | | ƒ } | o | d  } Pn | d d j o q¼ n t	 o d	 t | ƒ GHn | d  | } q¼ Wt	 o d
 t | ƒ GHn t i | ƒ } | o€ | i ƒ  d } t |	 | t ƒ } | t j oA |	 i o  |	 i ƒ  } t |	 | | ƒ n t | d | f ‚ n | i }
 qC n t i | ƒ } | où | i ƒ  \ } } |
 i | t ƒ } | o | d | } n | } | t j oD | i  o# | | i  ƒ } t | | | ƒ n t | d | f ‚ n y | i" | |
 | ƒ Wn7 t | d | t# i$ ƒ  d t# i$ ƒ  d f f ‚ n X| i |
 | <qC n t	 o d | t | ƒ f GHn qC Wx‹| i% ƒ  D]}\ } } t' | t( ƒ o | i t) j	 o | i | | <n[ y' | i" | i* |
 | ƒ | i | | <Wn0 t d d | t+ t# i$ ƒ  d ƒ f f ‚ n Xnã t' | t, ƒ oÒ | i }
 | } x¼ |
 i% ƒ  D]® \ } } t' | t( ƒ o’ | i t) j	 o | i |
 | <nn y' | i" | i* |
 | ƒ | i |
 | <WnC d k- } | i. ƒ  t d d | t+ t# i$ ƒ  d ƒ f f ‚ n Xn qWn qSWd S(   s}    Read and parse the open file.

            The configuration is stored in the instance variable
            .data.

        s    i    s   Reading config file:i   s   #s    read %siÿÿÿÿs   \s    read continuation %ss    processing %ss   unkown section "%s"s   .s   unkown attribute: "%s"s)   invalid attribute value for "%s" (%s: %s)s(   Ignoring invalid config file line %i: %ss4   invalid default attribute value for global "%s" (%s)Ns3   invalid default attribute value for local "%s" (%s)(/   s   contexts   sectionnames   selfs   datas   sections   __dict__s   globalss   localss   linenos   _debugs   files   readlines   lines   strips   reprs   current_linenos   nextlines   parse_sections   matchs   ms   groupss   getattrs   Nones   DefaultSections   setattrs   Errors   parse_setattrs   names   values   gets   entrys   attrnames   DefaultAttributes   deepcopys   parses   syss   exc_infos   itemss   objs
   isinstances   Entrys   NotGivens   defaults   strs   ConfigSections	   tracebacks	   print_exc(   s   selfs   files   strips   deepcopys   nextlines   sectionnames   attrnames   globalss   lines   datas   localss   names   objs	   tracebacks   ms   values   linenos   contexts   entrys   sections   current_lineno(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   reads¾    	 			 
 



	
4 1	 (   s   __name__s
   __module__s   __doc__s   Nones   datas   __init__s   copys   deepcopys   typess	   ClassTypes
   ModuleTypes   resets   strings   strips   read(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys
   ConfigFileçs
    	s   __main__s   Templatec      s[   t  Z d  k Z e d ƒ Z e d ƒ Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 e Z
 RS(   Ni   s    s   ABCc      sP   t  Z e d ƒ Z e d ƒ Z e ƒ  Z e d ƒ Z e	 d ƒ Z
 e d d ƒ Z RS(   Ns   0s   default.htmls   a,bs   .s   ..s    (   s   __name__s
   __module__s   IntegerEntrys   as   StringEntrys   bs   cs   StringTupleEntrys   ds   ExistingPathEntrys   paths   RelativePathEntrys   DefaultAttribute(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ABC²s   	s   DEFc      sk   t  Z e d ƒ Z e d ƒ Z e d ƒ Z e d d ƒ Z	 e d ƒ Z
 e d ƒ Z e d ƒ Z e d ƒ Z RS(   Ns   0s   default values   $ABC.bs   HOMEs    s
   0:15:00.23(   s   __name__s
   __module__s   IntegerEntrys   as	   EvalEntrys   bs   StringEntrys   cs   RelativePathEntrys   ds   gs   CommaTupleEntrys   continuations	   DictEntrys	   databasess	   TimeEntrys   timeout(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   DEF¼s   (   s   __name__s
   __module__s   syss   IntegerEntrys	   globalvars   StringEntrys   DefaultAttributes   ConfigSections   ABCs   DEFs   DefaultSection(    (    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   Template©s   	
sì      # Luckily we don't have to pay attention to proper indentation
    # or whether strings have quotes or not... the template knows
    # what to do.

    globalvar = 2

    # New global attribute
    test = text

    [ABC]
    a = 1
    b = abc.html
    c = text with spaces
    d = heinz, kunz, philipp
    path = /tmp

    # A new attribute
    new = .cshrc

    [DEF]
    a = 2
    b = a + 3
    c = $PWD
    d = home

    continuation = first line, \
                   # Comment should not hurt
                   second line, \

                   # Invalid syntax:
                   third line \

    databases = 'iODBC': (sys,sys.exit,('c',1,2)), \
                'Adabas': (sys,sys.exit,('x','y','z'))

    [NewSection]
    a = 3

    (G   s   __doc__s   strings   copys   res   typess
   exceptionss   syss   oss   mx.Tools.NewBuiltinss   mxs   mx.Toolss   freezes	   Namespaces   _debugs   StandardErrors   Errors   compiles	   shell_vars   splits   expand_varss   Entrys   IntegerEntrys
   FloatEntrys   NumericEntrys   StringEntrys   strips   maps   tuples
   comma_lists   spaced_lists
   TupleEntrys   StringTupleEntrys   CommaTupleEntrys	   ListEntrys   StringListEntrys   CommaListEntrys   SpacedTupleEntrys   SpacedListEntrys	   FileEntrys	   PathEntrys   AbsoluteFileEntrys   AbsolutePathEntrys   RelativePathEntrys   RelativeFileEntrys   ExistingPathEntrys   ExistingFileEntrys   ExistingRelativePathEntrys   URLEntrys   RelativeURLEntrys   AbsoluteURLEntrys	   DateEntrys   DateTimeEntrys	   TimeEntrys   DateTimeDeltaEntrys   RelativeDateTimeEntrys	   EvalEntrys   SafeEvalEntrys	   DictEntrys   ConfigNamespaces   ConfigSections   parse_sections   parse_setattrs
   ConfigFiles   __name__s   Templates   texts	   cStringIOs   StringIOs   fs   cfs   read(;   s
   TupleEntrys	   cStringIOs	   PathEntrys   Templates   SpacedListEntrys   texts   spaced_lists	   Namespaces   cfs   freezes   CommaTupleEntrys   AbsoluteURLEntrys	   FileEntrys	   DateEntrys   Entrys   StringTupleEntrys   AbsoluteFileEntrys   ExistingRelativePathEntrys	   DictEntrys   _debugs   ExistingFileEntrys   res   RelativeFileEntrys
   ConfigFiles   StringEntrys
   FloatEntrys	   ListEntrys
   comma_lists   parse_sections   NumericEntrys   strings   RelativeDateTimeEntrys   IntegerEntrys   ExistingPathEntrys	   shell_vars   syss   RelativePathEntrys	   EvalEntrys   parse_setattrs   Errors   CommaListEntrys   copys   DateTimeEntrys   URLEntrys   typess   ConfigNamespaces	   TimeEntrys   ConfigSections   SafeEvalEntrys   fs   SpacedTupleEntrys   RelativeURLEntrys   StringListEntrys   expand_varss   DateTimeDeltaEntrys
   exceptionss   AbsolutePathEntrys   oss   mx(    (    s<   /mit/seven/lib/python2.2/site-packages/mx/Misc/ConfigFile.pys   ?N sn   ?		+RtÀ )	