def get(self): account_count = Account.all().count(1000) app_count = App.all().count(1000) html = """<?xml version="1.0" encoding="UTF-8"?> <root> <item> <value>%(app_count)d</value> <text>Apps</text> </item> <item> <value>0</value> <text></text> </item> <item> <value>%(account_count)d</value> <text>Accounts</text> </item> </root> """ % dict( account_count=account_count, app_count=app_count ) # return Response(html, content_type="text/xml") self.response.headers["Content-Type"] = "text/xml" self.response.write(html)
def get(self, user, account, **kwargs): users_info = {} app_query = App.all() if not users.is_current_user_admin(): app_query = app_query.filter('editors', account.key()) apps = app_query.fetch(100) accounts_by_key = {} for acc in Account.get( set([app._created_by for app in apps] + [account.key()])): accounts_by_key[acc.key()] = acc users_info[acc.user.user_id()] = { 'apps': [], 'full_name': acc.full_name or '', 'email': acc.user.email(), 'created_at': time.mktime(acc.created_at.timetuple()), } for app in apps: users_info[accounts_by_key[ app._created_by].user.user_id()]['apps'].append({ 'id': app.key().id(), 'body': app.body, }) return render_json_response( self, { 'users': users_info, 'current_user': account.user.user_id() if account else None })
def get(self, user, account, **kwargs): users_info = {} app_query = App.all() if not users.is_current_user_admin(): app_query = app_query.filter("editors", account.key()) apps = app_query.fetch(100) accounts_by_key = {} for acc in Account.get(set([app._created_by for app in apps] + [account.key()])): accounts_by_key[acc.key()] = acc users_info[acc.user.user_id()] = { "apps": [], "full_name": acc.full_name or "", "email": acc.user.email(), "created_at": time.mktime(acc.created_at.timetuple()), } for app in apps: users_info[accounts_by_key[app._created_by].user.user_id()]["apps"].append( {"id": app.key().id(), "body": app.body} ) return render_json_response( self, {"users": users_info, "current_user": account.user.user_id() if account else None} )
def get(self): admin = authorizedAdminClient() if admin: app_id = cgi.escape(self.request.get("app")) encoded_app_id = base64.b64encode(app_id) apps = App.all() apps.filter('app_id =', app_id) app = apps.get() self.render(u'app_menu', app=app, encoded_app_id=encoded_app_id) else: self.render(u'unauthorized', user=users.get_current_user(), login_url=users.create_login_url("/"), logout_url=users.create_logout_url("/"))
def get(self): account_count = Account.all().count(1000) app_count = App.all().count(1000) html = """ <pre> Mockko statistics: Users: %(account_count)d Applications: %(app_count)d """ % dict(account_count=account_count, app_count=app_count) # return Response(html, content_type="text/html") self.response.headers['Content-Type'] = 'text/html' self.response.write(html)
def get(self): account_count = Account.all().count(1000) app_count = App.all().count(1000) html = """ <pre> Mockko statistics: Users: %(account_count)d Applications: %(app_count)d """ % dict( account_count=account_count, app_count=app_count ) # return Response(html, content_type="text/html") self.response.headers["Content-Type"] = "text/html" self.response.write(html)
def get(self): account_count = Account.all().count(1000) app_count = App.all().count(1000) html = """<?xml version="1.0" encoding="UTF-8"?> <root> <item> <value>%(app_count)d</value> <text>Apps</text> </item> <item> <value>0</value> <text></text> </item> <item> <value>%(account_count)d</value> <text>Accounts</text> </item> </root> """ % dict(account_count=account_count, app_count=app_count) # return Response(html, content_type="text/xml") self.response.headers['Content-Type'] = 'text/xml' self.response.write(html)
def update_all(): for app in App.all(): update_app(app)
def get(self): app_id = self.request.get("app") apps = App.all() apps.filter('app_id =', app_id) app = apps.get() self.render(u'permissions', app=app)