Esempio n. 1
0
 def post(self):
     inputid = self.request.get('id')
     MyRecord = Condition.get(inputid)
     template_values = {'MyRecord': MyRecord}
     self.response.out.write(
         render_view.full_view('List', template_values,
                               'edit_cond_body.html'))
Esempio n. 2
0
  def get(self):
  # Get prices for current conditions
    PriceSet = cond_checkjob.get_price()
    if PriceSet['Status'] == 'NoRecords':
      Results = {1:{'stock':'','condition':'','price':'','currentprice':'','currentcond':'','match':''}}
    else:
  # Query for Conditions
      QueryUser = users.get_current_user()
      Conditions = db.GqlQuery("SELECT * "
                            "FROM Condition "
                            "WHERE status = :1 "
                            "AND author = :2 "
                            "ORDER BY date DESC ",
                            "Active", QueryUser)
  # Set counter to zero and create blank result set.
      ResultCounter = 0							
      Results = {1:{'stock':'a','condition':'b','price':'c','currentprice':'d','currentcond':'e','match':'f'}}
#      Results.update = {2:{'stock':'ab','condition':'b','price':'c','currentprice':'d','currentcond':'e','match':'f'}}
  # Check whether conditions are met and update status
      for Condition in Conditions:
        ResultCounter = ResultCounter + 1
        current_price = float(PriceSet[Condition.stock])
        cond_price = float(Condition.price)
        current_cond = cond_checkjob.price_compare(current_price, cond_price)
        if current_cond == Condition.expcheck:
          match_cond = 'True'
#        Condition.status = 'Matched'
          Condition.put()
        else:
          match_cond = 'False'	  
        Results.update({ResultCounter:{'stock':Condition.stock,'condition':Condition.expcheck,'price':cond_price,'currentprice':current_price,'currentcond':current_cond,'match':match_cond}})
    template_values = {'results': Results}
    self.response.out.write(render_view.full_view('Check', template_values, 'check_cond_body.html'))
Esempio n. 3
0
  def get(self):
    if len(self.request.get('RunKey')) > 0:
      ParentRun = self.request.get('RunKey')
      query = db.GqlQuery("SELECT * FROM CheckLog WHERE ANCESTOR IS :1 "
	                 "ORDER BY date DESC", ParentRun)
      PageTitle = 'Check Logs: Run No. %s ' % CheckRun.get(ParentRun).key().id()
    else:
      query = db.GqlQuery("SELECT * FROM CheckLog "
	                 "ORDER BY date DESC" )
      PageTitle = 'Check Logs' 
      ParentRun = ''
	  
    myAction = self.request.get('action')
    if myAction == 'next':
      RecordCount = query.count()
      FetchMax = int(self.request.get('FetchLocation')) + 15
      if FetchMax < RecordCount:
        FetchLocation = FetchMax
      else:
        FetchLocation = int(self.request.get('FetchLocation'))  
    elif myAction == 'previous':
      FetchLocation = int(self.request.get('FetchLocation')) - 15
      if FetchLocation < 0:
        FetchLocation = 0
    else:
      FetchLocation = 0
    
    CheckLogs = query.fetch(15, FetchLocation)

    template_values = {'CheckLogs': CheckLogs, 'FetchLocation': FetchLocation, 'PageTitle':PageTitle, 'ParentRun':ParentRun}
    self.response.out.write(render_view.full_view('', template_values, 'check_logs_body.html'))
Esempio n. 4
0
    def get(self):
        query = db.GqlQuery("SELECT * FROM CheckRun " "ORDER BY date DESC")
        PageTitle = "Check Runs"
        myAction = self.request.get('action')
        if myAction == 'next':
            RecordCount = query.count()
            FetchMax = int(self.request.get('FetchLocation')) + 15
            if FetchMax < RecordCount:
                FetchLocation = FetchMax
            else:
                FetchLocation = int(self.request.get('FetchLocation'))
        elif myAction == 'previous':
            FetchLocation = int(self.request.get('FetchLocation')) - 15
            if FetchLocation < 0:
                FetchLocation = 0
        else:
            FetchLocation = 0

        CheckRuns = query.fetch(15, FetchLocation)
        template_values = {
            'CheckRuns': CheckRuns,
            'FetchLocation': FetchLocation,
            'PageTitle': PageTitle
        }
        self.response.out.write(
            render_view.full_view('', template_values, 'check_runs_body.html'))
Esempio n. 5
0
 def get(self):
   inputid = self.request.get('id')
   if len(inputid) > 0: 
     MyRecord = TwiProfile.get(inputid)
   else:
     MyRecord = {}	
   template_values = {'MyRecord':MyRecord}
   self.response.out.write(render_view.full_view('', template_values, 'twi_profile_body.html'))
Esempio n. 6
0
 def get(self):
     ListType = self.request.get("listtype")
     if ListType == "allsorts":
         Conditions = db.GqlQuery("SELECT * " "FROM Condition " "ORDER BY date DESC")
     else:
         QueryUser = users.get_current_user()
         Conditions = db.GqlQuery("SELECT * " "FROM Condition " "WHERE author = :1 " "ORDER BY date DESC", QueryUser)
     template_values = {"Conditions": Conditions}
     self.response.out.write(render_view.full_view("List", template_values, "list_body.html"))
Esempio n. 7
0
 def get(self):
     inputid = self.request.get('id')
     if len(inputid) > 0:
         MyRecord = TwiProfile.get(inputid)
     else:
         MyRecord = {}
     template_values = {'MyRecord': MyRecord}
     self.response.out.write(
         render_view.full_view('', template_values,
                               'twi_profile_body.html'))
Esempio n. 8
0
 def get(self):
     UserList = users.get_current_user()
     TwiProfile = db.GqlQuery("SELECT * FROM TwiProfile ")
     UserProfiles = db.GqlQuery("SELECT * FROM UserList ")
     template_values = {
         'UserList': UserList,
         'TwiProfile': TwiProfile,
         'UserProfiles': UserProfiles
     }
     self.response.out.write(
         render_view.full_view('', template_values, 'users_body.html'))
Esempio n. 9
0
  def get(self):
    q = db.GqlQuery("SELECT * FROM CheckJobSettings ")
    if q.count() > 0:
      Settings = q.get()
    else:
      Settings = CheckJobSettings()
      Settings.detaillog = True
      Settings.put()

    template_values = {'Settings': Settings}
    self.response.out.write(render_view.full_view('', template_values, 'check_setting_body.html'))
Esempio n. 10
0
 def get(self):
     QueryUser = users.get_current_user()
     Conditions = db.GqlQuery(
         "SELECT * "
         "FROM Condition "
         "WHERE author = :1 "
         "ORDER BY date DESC", QueryUser)
     template_values = {'Conditions': Conditions}
     self.response.out.write(
         render_view.full_view('Create', template_values,
                               'create_cond_body.html'))
Esempio n. 11
0
    def get(self):
        q = db.GqlQuery("SELECT * FROM CheckJobSettings ")
        if q.count() > 0:
            Settings = q.get()
        else:
            Settings = CheckJobSettings()
            Settings.detaillog = True
            Settings.put()

        template_values = {'Settings': Settings}
        self.response.out.write(
            render_view.full_view('', template_values,
                                  'check_setting_body.html'))
Esempio n. 12
0
 def get(self):
   UserId = users.get_current_user()
   UserProfile = db.GqlQuery("SELECT * FROM UserList WHERE goog_id = :1", UserId)
   for Profile in UserProfile:
     if Profile.twilio_id:
       MyTwi = TwiProfile.get(Profile.twilio_id.key())
     else:
       MyTwi = TwiProfile()
       MyTwi.profile_name = str(Profile.goog_id)
   	MyTwi.put()      
       Profile.twilio_profile = MyTwi.profile_name
       Profile.twilio_id = MyTwi.key()
       Profile.put()
     template_values = {'MyRecord':Profile, 'TwilioRecord':MyTwi}
     self.response.out.write(render_view.full_view('Profile', template_values, 'myprofile_body.html'))
Esempio n. 13
0
 def get(self):
     ListType = self.request.get('listtype')
     if ListType == 'allsorts':
         Conditions = db.GqlQuery(
             "SELECT * "
             "FROM Condition "
             "ORDER BY date DESC", )
     else:
         QueryUser = users.get_current_user()
         Conditions = db.GqlQuery(
             "SELECT * "
             "FROM Condition "
             "WHERE author = :1 "
             "ORDER BY date DESC", QueryUser)
     template_values = {'Conditions': Conditions}
     self.response.out.write(
         render_view.full_view('List', template_values, 'list_body.html'))
Esempio n. 14
0
  def get(self):
    inputid = self.request.get('id')
    if len(inputid) > 0: 
      MyRecord = UserList.get(inputid)
    else:
      user = users.get_current_user()
      q = db.GqlQuery("SELECT * FROM UserList WHERE goog_id = :1", user)
      if q.count() > 0:
        MyRecord = q.get()
      else:
        MyRecord = UserList()
        MyRecord.goog_id = user
    	MyRecord.put()
    TwiProfile = db.GqlQuery("SELECT * FROM TwiProfile ")

    template_values = {'MyRecord':MyRecord, 'TwiProfile':TwiProfile}
    self.response.out.write(render_view.full_view('', template_values, 'user_profile_body.html'))
Esempio n. 15
0
 def get(self):
     UserId = users.get_current_user()
     UserProfile = db.GqlQuery("SELECT * FROM UserList WHERE goog_id = :1",
                               UserId)
     for Profile in UserProfile:
         if Profile.twilio_id:
             MyTwi = TwiProfile.get(Profile.twilio_id.key())
         else:
             MyTwi = TwiProfile()
             MyTwi.profile_name = str(Profile.goog_id)
             MyTwi.put()
             Profile.twilio_profile = MyTwi.profile_name
             Profile.twilio_id = MyTwi.key()
             Profile.put()
         template_values = {'MyRecord': Profile, 'TwilioRecord': MyTwi}
         self.response.out.write(
             render_view.full_view('Profile', template_values,
                                   'myprofile_body.html'))
Esempio n. 16
0
    def get(self):
        inputid = self.request.get('id')
        if len(inputid) > 0:
            MyRecord = UserList.get(inputid)
        else:
            user = users.get_current_user()
            q = db.GqlQuery("SELECT * FROM UserList WHERE goog_id = :1", user)
            if q.count() > 0:
                MyRecord = q.get()
            else:
                MyRecord = UserList()
                MyRecord.goog_id = user
                MyRecord.put()
        TwiProfile = db.GqlQuery("SELECT * FROM TwiProfile ")

        template_values = {'MyRecord': MyRecord, 'TwiProfile': TwiProfile}
        self.response.out.write(
            render_view.full_view('', template_values,
                                  'user_profile_body.html'))
Esempio n. 17
0
  def get(self):
    query = db.GqlQuery("SELECT * FROM CheckRun "
	                 "ORDER BY date DESC" )
    PageTitle = "Check Runs"  
    myAction = self.request.get('action')
    if myAction == 'next':
      RecordCount = query.count()
      FetchMax = int(self.request.get('FetchLocation')) + 15
      if FetchMax < RecordCount:
        FetchLocation = FetchMax
      else:
        FetchLocation = int(self.request.get('FetchLocation'))  
    elif myAction == 'previous':
      FetchLocation = int(self.request.get('FetchLocation')) - 15
      if FetchLocation < 0:
        FetchLocation = 0
    else:
      FetchLocation = 0
  
    CheckRuns = query.fetch(15, FetchLocation)
    template_values = {'CheckRuns': CheckRuns, 'FetchLocation': FetchLocation, 'PageTitle':PageTitle}
    self.response.out.write(render_view.full_view('', template_values, 'check_runs_body.html'))
Esempio n. 18
0
    def get(self):
        if len(self.request.get('RunKey')) > 0:
            ParentRun = self.request.get('RunKey')
            query = db.GqlQuery(
                "SELECT * FROM CheckLog WHERE ANCESTOR IS :1 "
                "ORDER BY date DESC", ParentRun)
            PageTitle = 'Check Logs: Run No. %s ' % CheckRun.get(
                ParentRun).key().id()
        else:
            query = db.GqlQuery("SELECT * FROM CheckLog " "ORDER BY date DESC")
            PageTitle = 'Check Logs'
            ParentRun = ''

        myAction = self.request.get('action')
        if myAction == 'next':
            RecordCount = query.count()
            FetchMax = int(self.request.get('FetchLocation')) + 15
            if FetchMax < RecordCount:
                FetchLocation = FetchMax
            else:
                FetchLocation = int(self.request.get('FetchLocation'))
        elif myAction == 'previous':
            FetchLocation = int(self.request.get('FetchLocation')) - 15
            if FetchLocation < 0:
                FetchLocation = 0
        else:
            FetchLocation = 0

        CheckLogs = query.fetch(15, FetchLocation)

        template_values = {
            'CheckLogs': CheckLogs,
            'FetchLocation': FetchLocation,
            'PageTitle': PageTitle,
            'ParentRun': ParentRun
        }
        self.response.out.write(
            render_view.full_view('', template_values, 'check_logs_body.html'))
Esempio n. 19
0
 def get(self):
   UserList = users.get_current_user()
   TwiProfile = db.GqlQuery("SELECT * FROM TwiProfile ")
   UserProfiles = db.GqlQuery("SELECT * FROM UserList ")
   template_values = {'UserList':UserList, 'TwiProfile':TwiProfile, 'UserProfiles':UserProfiles}
   self.response.out.write(render_view.full_view('', template_values, 'users_body.html'))
Esempio n. 20
0
 def get(self):
     QueryUser = users.get_current_user()
     Conditions = db.GqlQuery("SELECT * " "FROM Condition " "WHERE author = :1 " "ORDER BY date DESC", QueryUser)
     template_values = {"Conditions": Conditions}
     self.response.out.write(render_view.full_view("Create", template_values, "create_cond_body.html"))
Esempio n. 21
0
 def post(self):
     inputid = self.request.get("id")
     MyRecord = Condition.get(inputid)
     template_values = {"MyRecord": MyRecord}
     self.response.out.write(render_view.full_view("List", template_values, "edit_cond_body.html"))
Esempio n. 22
0
 def get(self):
   template_values = {}
   self.response.out.write(render_view.full_view('', template_values, 'test_body.html'))
Esempio n. 23
0
 def get(self):
     template_values = {}
     self.response.out.write(
         render_view.full_view('About', template_values, 'about_body.html'))