Пример #1
0
    def __init__(self, env, req, content):
        """
      Initialize the Envoironment
    """
        # parse passed macro arguments
        args, kw = parse_args(content)
        self.macroid = str(kw.get("macroid")) or "1"
        self.macroargs = args

        # replace generic values
        for k in kw.keys():
            kw[k] = kw[k].replace("$user", req.authname)
        self.macrokw = kw

        # set constants
        self.const = PPConstant
        # set trac environment, request
        self.tracenv = env
        self.tracreq = req
        # load configuration items
        self.conf = PPConfiguration(env)
        # create cache
        self.cache = ppFSFileCache(
            self.conf.get("cachepath"), datetime.date.today().isoformat(), int(self.conf.get("cachedirsize"))
        )
        # initialize the cache hash value with environment settings
        self.mhash = self.cache.newHashObject()
        self.mhash.update(content)
        self.mhash.update(self.macroid)
        self.mhash.update(self.tracreq.authname)
        self.mhash.update(str(datetime.date.today()))
Пример #2
0
    def __init__(self, env, req, content):
        '''
      Initialize the Envoironment
    '''
        # parse passed macro arguments
        args, kw = parse_args(content)
        self.macroid = str(kw.get('macroid')) or '1'
        self.macroargs = args

        # replace generic values
        for k in kw.keys():
            kw[k] = kw[k].replace('$user', req.authname)
        self.macrokw = kw

        # set constants
        self.const = PPConstant
        # set trac environment, request
        self.tracenv = env
        self.tracreq = req
        # load configuration items
        self.conf = PPConfiguration(env)
        # create cache
        self.cache = ppFSFileCache(self.conf.get('cachepath'),
                                   datetime.date.today().isoformat(),
                                   int(self.conf.get('cachedirsize')))
        # initialize the cache hash value with environment settings
        self.mhash = self.cache.newHashObject()
        self.mhash.update(content)
        self.mhash.update(self.macroid)
        self.mhash.update(self.tracreq.authname)
        self.mhash.update(str(datetime.date.today()))
Пример #3
0
    def __init__(self, env, req, content):
        '''
      Initialize the Envoironment
    '''
        # parse passed macro arguments
        args, kw = parse_args(content)
        self.macroid = str(kw.get('macroid')) or '1'
        self.macroargs = args

        # replace generic values
        for k in kw.keys():
            kw[k] = kw[k].replace('$user', req.authname)
            kw[k] = kw[k].replace('$USER', req.authname)

        # replace ticket id placeholder with current ticket id (if available)
        try:
            ticket_id = re.search(r"/ticket/([0-9]+)", req.path_info).group(1)
            for k in kw.keys():
                kw[k] = kw[k].replace('$ticket', ticket_id)
                kw[k] = kw[k].replace('$TICKET', ticket_id)
        except:
            pass

        self.macrokw = kw

        # set constants
        self.const = PPConstant
        # set trac environment, request
        self.tracenv = env
        self.tracreq = req
        # load configuration items
        self.conf = PPConfiguration(env)
        # create cache
        self.cache = ppFSFileCache(self.conf.get('cachepath'),
                                   datetime.date.today().isoformat(),
                                   int(self.conf.get('cachedirsize')))
        # initialize the cache hash value with environment settings
        self.mhash = self.cache.newHashObject()
        self.mhash.update(content)
        self.mhash.update(self.macroid)
        self.mhash.update(self.tracreq.authname)
        self.mhash.update(str(datetime.date.today()))
Пример #4
0
 def __init__( self, env, req, content ):
   '''
     Initialize the Envoironment
   '''
   # parse passed macro arguments
   args, kw = parse_args( content )
   self.macroid = str( kw.get('macroid') ) or '1';
   self.macroargs = args
   
   # replace generic values    
   for k in kw.keys():
     kw[k] = kw[k].replace('$user', req.authname)
     kw[k] = kw[k].replace('$USER', req.authname)
   
   # replace ticket id placeholder with current ticket id (if available)
   try:
     ticket_id = re.search(r"/ticket/([0-9]+)",req.path_info).group(1)
     for k in kw.keys():
       kw[k] = kw[k].replace('$ticket', ticket_id)
       kw[k] = kw[k].replace('$TICKET', ticket_id)
   except:
     pass
     
   self.macrokw = kw
   
   # set constants
   self.const = PPConstant
   # set trac environment, request
   self.tracenv = env
   self.tracreq = req
   # load configuration items
   self.conf = PPConfiguration(env)
   # create cache
   self.cache = ppFSFileCache( self.conf.get( 'cachepath' ),
                               datetime.date.today().isoformat(),
                               int(self.conf.get( 'cachedirsize' )) )
   # initialize the cache hash value with environment settings
   self.mhash = self.cache.newHashObject()
   self.mhash.update( content )
   self.mhash.update( self.macroid )
   self.mhash.update( self.tracreq.authname )
   self.mhash.update( str( datetime.date.today() ) )