Example #1
0
    def post(self):
        util.start_session(self)##
        posts = myweb.get_post_vars()
        posts['created'] = str(datetime.now())
        obj = datastore.Entity(kind = "registrant")
        obj.update(posts) 
        if 'os0' in obj: # os0 is wether it's half or full payment
            pass
        else:
            obj['os0'] = 'Full Payment'
        datastore.Put(obj) #also could put a list of objs #what if this fails
        #self.response.out.write(obj.key())
        util.put_session(self,{'email': posts['email'], 'key':obj.key(), 'payment' : obj['os0']}) #saving some cookies, key is most important others save lines of code
        #mailed = free_email.email(self.email, "*****@*****.**", "New Registrant for timetoblossom", """
        mailed = free_email.blue_email(settings.from_email, settings.to_email, "New Registrant for timetoblossom", """
Timetoblossom.com
New Registrant
""" + obj['first'] + " " + obj['last'] + """ registered
See details at
http://timetoblossom.latest.clstff.appspot.com/view
""")        
        if mailed == True:
            obj['email_sent_to_carla'] = "yes"            
        else:
            obj['email_sent_to_carla'] = "no"
            #self.response.out.write("Sorry, something went wrong, please hit back and try again.")
        datastore.Put(obj) #save the email info
        #self.redirect("/paypal_submit") #this also works
        self.redirect("http://www.timetoblossom.com/pages/pay.htm")
Example #2
0
 def get(self):
     util.start_session(self)
     session = util.get_session(self)
     payment = 'Full Payment'        
     if 'payment' in session:
         payment = session['payment']
     self.response.out.write(pages.buy_now(payment))
Example #3
0
 def get(self):
     util.start_session(self)
     session = util.get_session(self)
     if ('key' in session):
         form = datastore.Get(session['key'])
         if 'email' in session:
             self.response.out.write(session['email'])
             mailed = free_email.blue_email(settings.from_email, session['email'] + ", " + settings.to_email, settings.thank_you_subject, settings.thank_you_body)
             if mailed:
                 form['email_sent'] = 'maybe'
             else:
                 form['email_sent'] = 'no'        
         else:
             form['email_sent'] = 'no'
             self.response.out.write("Thank you")
         datastore.Put(form)        
     self.redirect(settings.thank_you_url)
Example #4
0
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import sys
import schedule
import util
import config

def setup():
  # Initialise config.ini if it doesn't exist
  if not os.path.exists("config.ini"):
    config.init_default()

  # Ensure tokens exists
  util.get_tokens()

  # Set up the posting timetable
  util.set_session_scheduler()

  # Run the scheduler on its own thread
  util.run_scheduler_async()

if __name__ == "__main__":
  # For testing purposes
  if len(sys.argv) > 1:
    if "test" in sys.argv:
      util.testing = True
      util.start_session(wait=False)
    if "fb" in sys.argv:
      util.get_tokens()
    sys.exit()
  setup()