Skip to content

Commit

Permalink
htacess class no longer overrides the pattern key
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramez Hanna committed Jul 14, 2009
1 parent a3f65cf commit 88d969f
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions FNSynchro/FNSynchro.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ def parse_ini(self, cfg_file='/etc/FNSynchro/FNSynchro.ini', object='all'):
foo[section] = {}
for key in bar.keys():
if key == 'pattern' :
log.debug('parsing pattern')
log.debug('parsing pattern %s' % bar.get(key))
foo[section][key] = []
for pattern_item in bar.get(key).split('/'):
log.debug('parsing pattern item %s' %pattern_item)
if pattern_item.startswith('__'):
log.debug('item is a reference')
if not bar.get(pattern_item[2:]):
log.debug('reference is in general %s' % foo['general'][pattern_item[2:]])
foo[section][key].append(foo['general'][pattern_item[2:]])
else:
log.debug('reference is in same section %s' % bar.get(pattern_item[2:]))
foo[section][key].append(bar.get(pattern_item[2:]))
elif pattern_item.startswith(':'):
foo[section]['exceptions'] = []
Expand Down Expand Up @@ -191,6 +194,8 @@ def filter_gen(npattern,ipath=[],filter=''):
returns
str(filters): a string of "--filter=" arguments
"""
log.debug('starting filers generation')
log.debug('pattern used = %s' % npattern)
if len(npattern) < 1:
return filter
if len(ipath) == 0:
Expand All @@ -207,12 +212,14 @@ def filter_gen(npattern,ipath=[],filter=''):
return filter_gen(npattern,tmp_ipath,filter)

def sync(config):
log.debug('config is %s '% config)
npattern = config['pattern']
filters = filter_gen(npattern)
log.debug('filetrs = %s' % filters)
if config['excludes']:
for exclude in config['excludes']:
filters = filters + "--exclude='%s' " %exclude
if len(config['exceptions']) > 0:
if config.has_key('exceptions'):
for exception in config['exceptions']:
filters = filters + "--filter='+ **%s' " % exception
filters = filters + "--filter='+ **%s' " % os.path.dirname(exception)
Expand All @@ -237,7 +244,7 @@ def __init__(self, config, depthfirst = True, hidden = False, dir_only = True):
# self.CO.append(str(co))
#end
self.CO = ['nokia-closed', 'modified', 'ossw', 'nokia-open', 'zi', 'hanwang', 'art', 'ti', 'customization', 'real', 'nokia-emc', 'adobe','nokia-maps', 'eff', 'skype']
self.pattern = config['pattern']
self.pattern = list(config['pattern'])
self.config = config

def trees_gen(self, npattern, ipath=[], trees=[]):
Expand Down Expand Up @@ -273,15 +280,6 @@ def __walktree (self, top, depthfirst = True):
if depthfirst:
yield top, names

# def walktree(self):
# for top in self.pattern[0]:
# for lower in self.pattern[1]:
# log.debug(os.path.join(self.config['src'],top,lower))
# top = os.path.join(self.config['src'],top,lower)
# return self.__walktree(top, self.depthfirst)



def create_htaccess(self, path, product, type, CO = None):
ldapserver = 'localhost'
base = """AuthType basic
Expand Down

0 comments on commit 88d969f

Please sign in to comment.