コード例 #1
0
 def post(self):
   username = self.request.get('email')
   
   accounts = None
   if not username:
     accounts = accounts_dao.get_all_accounts()
   else:
     entity = accounts_dao.get(username)
     if not entity:
       self.error(400)
       return
     accounts = []
     accounts.append(entity)
   
   alldata = {'usage':[]}
   ''' retrieve all usage information summary (just API calls) '''
   for acc in accounts:
     q = APICountBatch.all().filter("account_key =", acc.key().name())
     values = {"success": "true", "email" : acc.email}
     res = q.fetch(1000) 
     values['total'] = q.count() or 1
     monthsdict = {}
     for ii in res:
       monthyear = ii.date.strftime('%Y-%m')
       curr=monthsdict.get(monthyear)
       if not curr:
         curr = 0
       curr += int(ii.counter)
       monthsdict[monthyear] = curr
     values['months'] = monthsdict
     alldata['usage'].append(values)
   
   self.response.out.write(simplejson.dumps(alldata))
コード例 #2
0
ファイル: accinfo.py プロジェクト: AkilDixon/UserInfuser
 def post(self):
   username = self.request.get('email')
   
   accounts = None
   if not username:
     accounts = accounts_dao.get_all_accounts()
   else:
     entity = accounts_dao.get(username)
     if not entity:
       self.error(400)
       return
     accounts = []
     accounts.append(entity)
   
   alldata = {'usage':[]}
   ''' retrieve all usage information summary (just API calls) '''
   for acc in accounts:
     q = APICountBatch.all().filter("account_key =", acc.key().name())
     values = {"success": "true", "email" : acc.email}
     res = q.fetch(1000) 
     values['total'] = q.count() or 1
     monthsdict = {}
     for ii in res:
       monthyear = ii.date.strftime('%Y-%m')
       curr=monthsdict.get(monthyear)
       if not curr:
         curr = 0
       curr += int(ii.counter)
       monthsdict[monthyear] = curr
     values['months'] = monthsdict
     alldata['usage'].append(values)
   
   self.response.out.write(json.dumps(alldata))
コード例 #3
0
ファイル: test.py プロジェクト: jshankhour1990/userinfuser
 def get(self):
     created_logs = ""
     for ii in constants.TEST_ACCOUNTS:
         acc = accounts_dao.get(ii)
         if acc:
             self.fill_with_api_logs(acc)
             created_logs = acc.key().name()
     if created_logs:
         self.response.out.write("Created logs for test account " + created_logs)
     else:
         self.response.out.write("Did not create any logs, create a test account first")
コード例 #4
0
ファイル: test.py プロジェクト: gunshor/UserInfuser
 def get(self):
     created_logs = ""
     for ii in constants.TEST_ACCOUNTS:
         acc = accounts_dao.get(ii)
         if acc:
             self.fill_with_api_logs(acc)
             created_logs = acc.key().name()
     if created_logs:
         self.response.out.write("Created logs for test account " +
                                 created_logs)
     else:
         self.response.out.write(
             "Did not create any logs, create a test account first")
コード例 #5
0
def groom_account(email):
  """ 
      Check the account and make sure accounts are updated with newest 
      parameters, widgets, users, etc
  """
  acc = accounts_dao.get(email)
  if not acc:
    logging.error("Unable to locate account ref for " + str(email))
    return 

  if not check_or_create_anonymous_user(acc):
    logging.error("Unable to get/create anonymous user for " + str(email))
    return 

  if not has_milestone_widget(acc):
    logging.error("Unable to get/create milestone wildget for" + str(email))
    return 
コード例 #6
0
def groom_account(email):
    """ 
      Check the account and make sure accounts are updated with newest 
      parameters, widgets, users, etc
  """
    acc = accounts_dao.get(email)
    if not acc:
        logging.error("Unable to locate account ref for " + str(email))
        return

    if not check_or_create_anonymous_user(acc):
        logging.error("Unable to get/create anonymous user for " + str(email))
        return

    if not has_milestone_widget(acc):
        logging.error("Unable to get/create milestone wildget for" +
                      str(email))
        return
コード例 #7
0
 def getQuery(self, context, obj):
     account_key = context['account_key']
     account_ref = accounts_dao.get(account_key)
     return Badges.all().filter('creator =', account_ref)
コード例 #8
0
ファイル: analytics.py プロジェクト: AppScale/UserInfuser
 def getQuery(self, context, obj):
   account_key = context['account_key']
   account_ref = accounts_dao.get(account_key)
   return Badges.all().filter('creator =', account_ref)