예제 #1
0
파일: tools.py 프로젝트: tonicbupt/account
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
예제 #2
0
파일: repos.py 프로젝트: petrus-hanks/titan
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
예제 #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