'Helper function to construct the output file name from
the repository path and the output file name pattern
@param task: the synchronization task
@return: the output file name, or None if either
path or pattern are missing'

def _output_file(self, task):

    path = self.repository.path
    if (not os.path.isabs(path)):
        path = os.path.join(current.request.folder, path)
    pattern = task.outfile_pattern
    if ((not path) or (not pattern)):
        return None
    from string import Template
    template = Template(pattern).safe_substitute(year='%(y)04d', month='%(m)02d', day='%(d)02d', hour='%(H)02d', minute='%(M)02d', second='%(S)02d', timestamp='%(y)04d%(m)02d%(d)02d%(H)02d%(M)02d%(S)02d')
    now = current.request.utcnow
    filename = (template % {'y': now.year, 'm': now.month, 'd': now.day, 'H': now.hour, 'M': now.minute, 'S': now.second})
    outfile = os.path.join(path, filename)
    return outfile
