This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onResume(){ | |
super.onResume(); | |
IntentFilter completeFilter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE); | |
registerReceiver(completeReceiver, completeFilter); | |
} | |
@Override | |
public void onPause(){ | |
super.onPause(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
class AdminLogsByTeamHandler(AdminHandler): # get | |
@admin_required | |
def get(self, team_id): | |
team_key = ndb.Key(Team, int(team_id)) | |
Quantity = namedtuple("Quantity", ["date", "account"]) | |
resolution_by_day = {} | |
logs = Log.query(Log.team == team_key).fetch() | |
for log in logs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RestModel(ndb.Model): | |
def to_dict(self, **kwargs): | |
result = super(RestModel, self).to_dict(**kwargs) | |
result['id'] = self.key.id() | |
parent_key = self.key.parent() | |
if parent_key is not None: | |
result['parent'] = parent_key.id() | |
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
from google.appengine.api import namespace_manager | |
def namespace_manager_default_namespace_for_request(): | |
if 'test' in os.environ['SERVER_NAME'] or 'Dev' in os.environ['SERVER_SOFTWARE']: | |
return 'test' | |
return namespace_manager.google_apps_namespace() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import webapp2 | |
from model import * | |
from google.appengine.api import memcache | |
import hashlib | |
import logging | |
import random | |
import string | |
import json |