本文整理汇总了Python中group.Group.gql方法的典型用法代码示例。如果您正苦于以下问题:Python Group.gql方法的具体用法?Python Group.gql怎么用?Python Group.gql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.gql方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare_content
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import gql [as 别名]
def prepare_content(handler, gcname, content):
# Same index retrieval used for unique group name checking
groups = Group.gql("WHERE name_c=:1 LIMIT 1", gcname)
if groups.count() != 1:
handler.error(404)
handler.response.out.write("Group identifier " + gcname + " not found")
return
group = groups[0];
qres = recent_group_reviews(group)
picurl = "img/emptyprofpic.png"
if group.picture:
picurl = "grppic?groupid=" + str(group.key().id())
# facebook doesn't like "../" relative urls
if "localhost" in handler.request.url:
picurl = "../" + picurl
else:
picurl = "http://www.fgfweb.com/" + picurl
content = re.sub('\$GROUPNAME', group.name, content)
content = re.sub('\$GROUPDESCR', group.description, content)
content = re.sub('\$IMGSRC', picurl, content)
content = re.sub('\$GROUPID', str(group.key().id()), content)
content = re.sub('\$GROUPJSON', obj2JSON(group), content)
content = re.sub('\$REVDATA', qres2JSON(
qres.objects, "", -1, ""), content)
refer = handler.request.referer
if refer:
refer = "<img src=\"../bytheimg?grpinqref=" +\
safeURIEncode(refer) + "\"/>\n"
else:
refer = "<img id=\"btwimg\" src=\"../bytheimg?grpinq=" +\
str(group.key().id()) + "\"/>\n"
content = re.sub('\$REFER', refer, content)
content = re.sub('\"', "\\\"", content) #browser interp pre-parse
return content