本文整理汇总了Python中nateusers.FBUser.get_by_key_name方法的典型用法代码示例。如果您正苦于以下问题:Python FBUser.get_by_key_name方法的具体用法?Python FBUser.get_by_key_name怎么用?Python FBUser.get_by_key_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nateusers.FBUser
的用法示例。
在下文中一共展示了FBUser.get_by_key_name方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sendDriverEmail
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
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)
示例2: sendRiderEmail
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
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)
示例3: get
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
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()
})))
示例4: get
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
def get(self):
drivernum = self.request.get('dkey')
user = FBUser.get_by_key_name(drivernum)
doRender(self, 'ratedriver.html', {
'driver': user.nickname(),
'drivernum':drivernum
})
示例5: post
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
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")
示例6: post
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
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")
示例7: get
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
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")
示例8: post
# 需要导入模块: from nateusers import FBUser [as 别名]
# 或者: from nateusers.FBUser import get_by_key_name [as 别名]
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")