def empty_datastore(request): query = User.all() while query.count() > 0: results = query.fetch(500) db.delete(results) query = User.all() query = Link.all() while query.count() > 0: results = query.fetch(500) db.delete(results) query = Link.all() query = Tag.all() while query.count() > 0: results = query.fetch(500) db.delete(results) query = Tag.all() return HttpResponseRedirect('/delvicious/')
def fetch_bookmarks(request): curuser = request.user #curuser = users.get_current_user() if curuser.is_authenticated(): bookmarks = search_http(curuser.username, curuser.unhashed_password) if len(bookmarks) > 0: for bookmark in bookmarks: query = Link.all() query.filter('username ='******'url =', bookmark.getAttribute('href').replace('&', '&')) if not query: b = Link() b.username = curuser.username b.url = bookmark.getAttribute('href').replace('&', '&') b.title = bookmark.getAttribute('description') b.put() return HttpResponseRedirect('/delvicious/') else: return render_to_response('delvicious/text.html', {'text': 'no bookmarks for ' + curuser.username + ' with password='******'___'}) else: return render_to_response('delvicious/text.html', {'text': 'no user'})
def serve_xml(request, username): q = User.all() q.filter('username ='******'delvicious/annotations.xml', {'links': Link.gql("WHERE username = :1 ", username), 'username': username})