Exemplo n.º 1
0
def doindex(handler):
    tagname=handler.request.get('tag')
    entries=[]
    if tagname:
        tag=Tag.all().filter('name = ', tagname).get()
        if tag and tag.tagedEntries:
            for tagedEntry in tag.tagedEntries:
                if not(tagedEntry.entry.cparent) and tagedEntry.entry.user and tagedEntry.entry.user.nickname()=='JoeyKBlack':
                    entries.append(tagedEntry.entry)
    else:
        for entry in Entry.all().fetch(100):
            if not(entry.cparent) and entry.user and entry.user.nickname()=='JoeyKBlack':
                entries.append(entry)
    entries.reverse()
    
    util.imageafi(entries)
    
    template_values = {
            'entries':entries,
            'ispost':users.is_current_user_admin(),
            'filters':util.filters('')
        }

    template_values.update(util.loadstd(handler))

    path = os.path.join(os.path.dirname(__file__), '../html/index.html')
    handler.response.out.write(template.render(path, template_values))
    

    
Exemplo n.º 2
0
def dopostit(handler, entryform=EntryForm(), editkey='', tags=''):
    tagname=handler.request.get('tag')
    entries=[]
    if tagname:
        tag=Tag.all().filter('name = ', tagname).get()
        if tag and tag.tagedEntries:
            for tagedEntry in tag.tagedEntries:
                if not(tagedEntry.entry.cparent):
                    entries.append(tagedEntry.entry)
    else:
        for entry in Entry.all().fetch(100):
            if not(entry.cparent):
                entries.append(entry)
    entries.reverse()
    
    util.imageafi(entries)
    
    username=''
    if users.get_current_user():
        username=users.get_current_user().nickname()
    
    template_values = {
                           'currentuser':username,
                           'filters':util.filters('postit'),
                           'entryform':entryform,
                           'entries':entries,
                           'editkey':editkey,
                           'tags':tags
            }

    template_values.update(util.loadstd(handler))
    path = os.path.join(os.path.dirname(__file__), '../html/postit.html')
    handler.response.out.write(template.render(path, template_values))