예제 #1
0
파일: funcs.py 프로젝트: markuspf/GapWWW
 def recurse(MIXERROOT, path, text, dirs):
     if not (os.path.exists(MIXERROOT + path + 'tree')):
         err.write('Error: Cannot find tree information: "' + path +
                   "tree" + '"!\n')
         sys.exit(10)
     node = maxml.parse_file(MIXERROOT + path + 'tree')
     # make a directory node:
     t = tree(path, node.attr['file'], text)
     i = 0
     while i < len(node.subs):
         sub = node.subs[i]
         if type(sub) == types.StringType:
             del node.subs[i]
         else:
             if os.path.isdir(MIXERROOT + path + sub.attr['file']):
                 t.addchild(
                     sub.attr['file'],
                     recurse(MIXERROOT, path + sub.attr['file'] + '/',
                             sub.subs[0], dirs))
             else:
                 t.addchild(sub.attr['file'],
                            tree(path, sub.attr['file'], sub.subs[0]))
             i += 1
     dirs[path] = t
     return t
예제 #2
0
파일: funcs.py 프로젝트: gap-system/GapWWW
 def recurse(MIXERROOT, path, text, dirs):
     if not (os.path.exists(MIXERROOT + path + "tree")):
         err.write('Error: Cannot find tree information: "' + path + "tree" + '"!\n')
         sys.exit(10)
     node = maxml.parse_file(MIXERROOT + path + "tree")
     # make a directory node:
     t = tree(path, node.attr["file"], text)
     i = 0
     while i < len(node.subs):
         sub = node.subs[i]
         if type(sub) == types.StringType:
             del node.subs[i]
         else:
             if os.path.isdir(MIXERROOT + path + sub.attr["file"]):
                 t.addchild(sub.attr["file"], recurse(MIXERROOT, path + sub.attr["file"] + "/", sub.subs[0], dirs))
             else:
                 t.addchild(sub.attr["file"], tree(path, sub.attr["file"], sub.subs[0]))
             i += 1
     dirs[path] = t
     return t
예제 #3
0
    print 'Reading configuration...'

config = {}
execfile(MIXERLIB + 'config', config)
config['today'] = time.ctime()

# Update our configuration from the local one in funcs:
try:
    config.update(funcs.config)
except:
    pass  # we ignore if there is no funcs.config

if quiet < 2:
    print 'Reading addresses...'
addresses = maxml.parse_file(MIXERLIB + 'addresses')
if addresses.type != 'addresses':
    err.write("Error: Address database has no top element <addresses>!\n")
    sys.exit(6)
people = {}
for t in addresses.subs:
    if type(t) == types.InstanceType and t.type == 'person':
        if t.attr.has_key('id'):
            people[t.attr['id']] = t.attr
for p in people:
    if people[p].has_key('sameaddressas'):
        other = people[people[p]['sameaddressas']]
        for a in ('phone', 'fax', 'department', 'university', 'city',
                  'zipcode', 'county', 'country', 'street', 'building'):
            if other.has_key(a): people[p].setdefault(a, other.get(a))
    mxutil.completeaddress(people[p])
예제 #4
0
파일: mixer.py 프로젝트: gap-system/Mixer
    print 'MIXERROOT         :'+MIXERROOT
    print 'MIXERLIB          :'+MIXERLIB

    print 'Reading configuration...'

config = {}
execfile(MIXERLIB+'config',config)
config['today'] = time.ctime()

# Update our configuration from the local one in funcs:
try: config.update(funcs.config)
except: pass   # we ignore if there is no funcs.config

if quiet < 2:
    print 'Reading addresses...'
addresses = maxml.parse_file(MIXERLIB+'addresses')
if addresses.type != 'addresses':
    err.write("Error: Address database has no top element <addresses>!\n")
    sys.exit(6)
people = {}
for t in addresses.subs:
    if type(t) == types.InstanceType and t.type == 'person':
        if t.attr.has_key('id'):
            people[ t.attr['id'] ] = t.attr
for p in people:
    if people[p].has_key('sameaddressas'):
        other = people[people[p]['sameaddressas']]
        for a in ('phone','fax','department','university','city','zipcode',
                  'county','country','street','building'):
            if other.has_key(a): people[p].setdefault(a,other.get(a))
    mxutil.completeaddress(people[p])