コード例 #1
0
ファイル: reset.py プロジェクト: mpurdon/Buckets
    def get(self):
        user = users.get_current_user()
        
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return
        
        # Delete all list items
        self.response.out.write('<hr/>Deleting All Items<hr/>')
        all_items = ListItem.all()
        self.response.out.write('Deleting %d items<br/>' % all_items.count())
        for item in all_items:
            self.response.out.write('Deleted %s<br/>' % item)
            item.delete()
            
        # Delete all User Lists
        self.response.out.write('<hr/>Deleting All User Lists<hr/>')
        all_items = UserListItems.all()
        self.response.out.write('<hr/>Deleting %d user lists<hr/>' % all_items.count())
        for item in all_items:
            self.response.out.write('Deleted list for %s<br/>' % item.user)
            item.delete()

        self.add_people(user)
        #self.add_places(user)
        #self.add_things(user)

        self.response.out.write('<hr/>Flushing memcached<hr/>')
        
        # Flush memcache
        memcache.flush_all()
        
        self.response.out.write('<hr/>All Records<hr/>')
        for item in ListItem.all():
            self.response.out.write('%s<br/>' % item)

        self.response.out.write('<br/><a href="/">Back to home page...</a>')
コード例 #2
0
ファイル: main.py プロジェクト: mpurdon/Buckets
    def get(self):
        user = users.get_current_user()
        
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return
            
        query = ListItem.all()
        query.order('-__key__')
        
        template_values = {
            'user': user.nickname(),
            'list_items': query.fetch(10),
            'url': users.create_logout_url(self.request.uri),
            'url_text': 'Log out',
            'memcache_stats': memcache.get_stats()
        }

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