Esempio n. 1
0
def format_reply_list(items):
    for item in items:
        reply = Obj()
        if item.who != g.current_user.id:
            reply.user = get_user(item.who)
        else:
            reply.user = g.current_user
        reply.content = item.content
        reply.time = item.time
        yield reply
Esempio n. 2
0
def get_tree_with_content(jagare,
                          tree,
                          repo,
                          organization,
                          render=True,
                          version='master'):
    ret = []
    for d in tree:
        data = Obj()
        if d['type'] == 'blob':
            data.content, data.content_type, data.length = format_content(
                    jagare, repo, d['path'], render=render, version=version, \
            )
        else:
            continue
        data.name = d['name']
        data.sha = d['sha']
        data.type = d['type']
        data.ago = format_time(d['commit']['committer']['ts'])
        data.message = d['commit']['message'][:150]
        data.commit = d['commit']['sha']
        data.path = d['path']
        ret.append(data)
    return ret
Esempio n. 3
0
 def gen_tree(self, filenames, codes):
     for filename, content in zip(filenames, codes):
         d = Obj()
         d.name = filename
         d.content = lambda: content
         yield d