當前位置: 首頁>>代碼示例>>Python>>正文


Python nateusers.FBUser類代碼示例

本文整理匯總了Python中nateusers.FBUser的典型用法代碼示例。如果您正苦於以下問題:Python FBUser類的具體用法?Python FBUser怎麽用?Python FBUser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FBUser類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sendDriverEmail

    def sendDriverEmail(self,ride):

        if not ride.driver:
            return
        if choice != "facebook":
            to = ride.driver.email()
        else:
            logging.debug(ride.driver)
            to = FBUser.get_by_key_name(ride.driver)
            logging.debug(to)
        sender = FROM_EMAIL_ADDR
        subject = "New Passenger for your ride"
        p = db.get(ride.passengers[-1])
        user = FBUser.get_by_key_name(p.name)
        body = """
Dear %s,
We wanted to let you know that %s has been added to your ride
from %s to %s on %s.  If you need to contact %s you can do so at %s.

Thanks for being a driver!

Sincerely,

The Rideshare Team
""" % (to.nickname(), user.nickname(), ride.start_point_title, ride.destination_title,
       ride.ToD, user.nickname(), p.contact)

        if choice != "facebook":
            logging.debug(body)
            mail.send_mail(sender,to,subject,body)
        else:
            graph = facebook.GraphAPI(to.access_token)
            logging.debug(graph)
            graph.put_object("me", "feed", message=body)
開發者ID:bnmnetp,項目名稱:rideshare_old,代碼行數:34,代碼來源:main.py

示例2: sendRiderEmail

    def sendRiderEmail(self, ride, to):

        if choice == "facebook":
            to = FBUser.get_by_key_name(to)
            user = self.current_user
            logging.debug(to)
        sender = FROM_EMAIL_ADDR
        subject = "Change in your ride"

        body = """
Dear %s,

We have good news about your request for a ride from %s to %s on %s.
%s has agreed to drive.  You can contact the driver at %s.

Have a safe trip!

Sincerely,

The Rideshare Team
""" % (to.nickname(),  ride.start_point_title, ride.destination_title, ride.ToD,
       user.nickname(), ride.contact)
        if choice != "facebook":
            logging.debug(body)
            mail.send_mail(sender,to.email(),subject,body)
        else:
            graph = facebook.GraphAPI(to.access_token)
            graph.put_object("me", "feed", message=body)
開發者ID:bnmnetp,項目名稱:rideshare_old,代碼行數:28,代碼來源:main.py

示例3: get

  def get(self):

    user = FBUser.get_by_key_name(self.current_user.id)
    aquery = db.Query(College)
    mycollege= aquery.get()

    eventsList = []
    circles = []
    for item in user.circles:
        query = db.Query(Event)
        query.filter("ToD > ", datetime.date.today())
        query.filter("circle =",str(item))
        event_list = query.fetch(limit=100)
        logging.debug(event_list)
        for event in event_list:
          eventsList.append(event.to_dict())
        circles.append(Circle.get_by_id(int(item)))
    path = os.path.join(os.path.dirname(__file__), 'templates/main.html')
    self.response.out.write(str(template.render(path, {
            'event_list': eventsList,
            'circles' : circles,
            'college':mycollege,
            'logout':'/auth/logout',
            'nick':self.current_user.nickname()
            })))
開發者ID:srijib,項目名稱:rideshare-2,代碼行數:25,代碼來源:main.py

示例4: get

 def get(self):
     drivernum = self.request.get('dkey')
     user = FBUser.get_by_key_name(drivernum)
     doRender(self, 'ratedriver.html', {
         'driver': user.nickname(),
         'drivernum':drivernum
     })
開發者ID:bnmnetp,項目名稱:rideshare_old,代碼行數:7,代碼來源:main.py

示例5: post

 def post(self):
     drivernum = self.request.get("driver")
     text = self.request.get("ratetext")
     ooFrating = self.request.get("ooFrating")
     user= FBUser.get_by_key_name(drivernum)
     user.drivercomments.append(text)
     user.numrates = user.numrates + 1
     if user.rating== None:
         user.rating= float(ooFrating)
     else:
         user.rating= user.rating + float(ooFrating)
     user.put()
     doRender(self, "submit.html",{})
     self.redirect("/home")
開發者ID:bnmnetp,項目名稱:rideshare_old,代碼行數:14,代碼來源:main.py

示例6: post

 def post(self):
     aquery = db.Query(College)
     mycollege = aquery.get()  
     drivernum = self.request.get("driver")
     text = self.request.get("ratetext")
     ooFrating = self.request.get("ooFrating") # Out Of Five
     user = FBUser.get_by_key_name(drivernum)
     user.drivercomments.append(text)
     user.numrates = user.numrates + 1
     if user.rating == None:
         user.rating = float(ooFrating)
     else:
         user.rating = user.rating + float(ooFrating)
     user.put()
     doRender(self, "submit.html",{"college",mycollege})
     self.redirect("/home")
開發者ID:srijib,項目名稱:rideshare-2,代碼行數:16,代碼來源:main.py

示例7: get

    def get(self):
        ride_key = self.request.get("key")
        contact = self.request.get("contact")
        numpass = self.request.get("numpass")
        user = self.current_user
        
        ride = Ride.get(ride_key)
        ride.driver = user.id
        ride.drivername = FBUser.get_by_key_name(user.id).nickname()
        ride.contact = contact
        ride.max_passengers = int(numpass)
        ride.put()

        for p in ride.passengers:
            logger = logging.getLogger('MySite')
            logger.info(str(p))
            passenger = Passenger.get(p)
            if passenger.loginType =="google":
              self.sendRiderEmail(ride,passenger.email,"google")
            elif passenger.loginType=="facebook":
              self.sendRiderEmail(ride, passenger.name, "facebook")

        self.response.out.write("OK")
開發者ID:zaschim,項目名稱:rideshare,代碼行數:23,代碼來源:main.py

示例8: post

 def post(self):
   user = FBUser.get_by_key_name(self.current_user.id)
   
   user.circles = self.request.str_params.getall("circle")
   user.put()
   self.redirect("/main")
開發者ID:zaschim,項目名稱:rideshare,代碼行數:6,代碼來源:main.py


注:本文中的nateusers.FBUser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。