本文整理汇总了Python中stream.Stream.guesturl方法的典型用法代码示例。如果您正苦于以下问题:Python Stream.guesturl方法的具体用法?Python Stream.guesturl怎么用?Python Stream.guesturl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stream.Stream
的用法示例。
在下文中一共展示了Stream.guesturl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from stream import Stream [as 别名]
# 或者: from stream.Stream import guesturl [as 别名]
def post(self):
stream_name=self.request.get("streamname")
if len(stream_name)==0:
stream_name="untitledstream"
stream_tags=self.request.get("streamtags").split(',')
stream_subscribers=self.request.get("subscribers").split(';')
stream_url=self.request.get("url")
emailContext = self.request.get("context")
emailSubject = "Stream Update Info with UserID: " + users.get_current_user().nickname()
emailSender = users.get_current_user().email()
#Change! # streams=Stream.query(Stream.name==stream_name, Stream.author==users.get_current_user()).fetch()
streams=Stream.query(Stream.name==stream_name).fetch()
if (len(streams)<1):
stream=Stream()
count=CountViews(parent=ndb.Key('User',users.get_current_user().nickname()))
pic_num = Count_pic(parent = ndb.Key('Stream',stream_name))
pic_num.numbers = 0
pic_num.put()
stream.name=stream_name
count.name=stream_name
count.numbers=0
count.totalviews = 0
count.put()
stream.numberofpictures=0
stream.total=0
stream.author=users.get_current_user()
stream.author_name=users.get_current_user().nickname()
stream.url=urllib.urlencode({'streamname': stream.name})
stream.guesturl=urllib.urlencode({'showmore': stream.name+"=="+users.get_current_user().nickname()})
default_context = "Notice: " + users.get_current_user().nickname() + " add a new stream named '" + stream_name +"' and the link to the stream is: "+"http://mini1-test1.appspot.com/"+stream.guesturl+"\n\n"
if len(stream_tags) > 0:
stream.tag=stream_tags
if len(stream_subscribers[0])>0:
stream.subscribers=stream_subscribers
for emailReceiver in stream.subscribers:
mail.send_mail(sender = emailSender, to = emailReceiver, subject = emailSubject, body = default_context + emailContext)
if len(stream_url) > 0:
stream.coverurl = stream_url
else:
stream.coverurl = "https://pbs.twimg.com/profile_images/3207366683/25547cceacb728c382e49cd34d9e800a.png"
stream.put()
self.redirect('/management',permanent=False)
else:
self.redirect('/error', permanent = False)