当前位置: 首页>>代码示例>>Python>>正文


Python User.tags方法代码示例

本文整理汇总了Python中user.User.tags方法的典型用法代码示例。如果您正苦于以下问题:Python User.tags方法的具体用法?Python User.tags怎么用?Python User.tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user.User的用法示例。


在下文中一共展示了User.tags方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import tags [as 别名]
 def get(self):
     user = User()
     user.email = "[email protected]"
     user.picture = "http://upload.wikimedia.org/wikipedia/commons/7/7f/Emma_Watson_2013.jpg"
     user.first = "Alice"
     user.age = 19
     user.tagline = "I am awesome"
     user.tags = ["Python"]
     user.interests = ["tennis", "table tennis"]
     template_values = {"user":user}
     self.render("profile.html", **template_values)
开发者ID:minakhan01,项目名称:GoogleScholarsHackathon14,代码行数:13,代码来源:main.py

示例2: post

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import tags [as 别名]
 def post(self):
     user = User()
     user.picture = "http://upload.wikimedia.org/wikipedia/commons/7/7f/Emma_Watson_2013.jpg"
     user.email = self.request.get('email')
     user.age = int(self.request.get('age'))
     user.tagline = self.request.get('mission')
     user.tags = self.request.get('tags').split(",")
     user.intersts = self.request.get('interests')
     user.put()
     template_values = {"user":user}
     self.render("profile.html", **template_values)
开发者ID:minakhan01,项目名称:GoogleScholarsHackathon14,代码行数:13,代码来源:main.py

示例3: showAllComics

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import tags [as 别名]
def showAllComics(params):
	page = getPage(params)
	comics = comic.list(page,User.tags().nega)
	def getInfos():
		for id,title,tagids,tags in comics:
			try:
				medium = comic.findMedium(id,0)
			except Redirect:
				medium = 0x5c911
			if not medium:
				medium = 0x5c911
			checkModified(medium)
			yield medium,title,getType(medium),tags or ()
	if Session.head:
		for stuff in getInfos(): pass
		return

	if page > 0:
		Links.prev = unparseQuery({'p':page-1})
	if page + 1 < comic.numComics() / 0x20:
		Links.next = unparseQuery({'p':page+1})
	def formatLink(medium,i):
		if comic.pages(comics[i][0]) == 0:
			return '{:x}/'.format(comics[i][0])
		return '{:x}/0/'.format(comics[i][0])
	with makePage("{:x} Page Comics".format(page),
								custom_head=True) as (head,body):
		with head:
			makeLinks(getInfos(),formatLink)
		with body:
			with d.p as p:
				@p.committing
				def _():
					if Links.prev:
						d.a("Prev",href=Links.prev)
						if Links.next:
							p(' ')
					if Links.next:
						d.a("Next",href=Links.next)
开发者ID:cyisfor,项目名称:media-tagger,代码行数:41,代码来源:pages.py

示例4: fooget

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import tags [as 别名]
	def fooget(self):
		json,path,pathurl,params = parsePath(self.path)
		Session.handler = self
		Session.params = params

		Session.prefetching = 'X-moz' in self.headers and 'prefetch' in self.headers['X-moz']

		if len(path)>0 and len(path[0])>0 and path[0][0]=='~':
			mode = path[0][1:]
			page = dispatch(json,mode,path,params)
		else:
			Session.params = params
			implied = self.headers.get("X-Implied-Tags")
			if implied:
				tags = tagsModule.parse(implied,False)
			else:
				tags = tagsModule.parse("-special:rl",False)
			tags.update(User.tags())
			basic = Taglist()

			for thing in path:
				if thing:
					thing = urllib.parse.unquote(thing)
					bitt = tagsModule.parse(thing,False)
					tags.update(bitt)
					basic.update(bitt)
			tagfilter.filter(tags)
			print('effective tags',repr(tags))
			o = params.get('o')
			if o:
				o = int(o[0],0x10)
			else:
				o = 0

			if json:
				disp = jsony
			else:
				disp = pages
			def prevnext(f):
				with disp.Links():
					if json:
						disp.Links.next = o + 1
					else:
						params['o'] = o + 1
						disp.Links.next = disp.unparseQuery(params)
					if o > 0:
						if json:
							disp.Links.prev = o - 1
						else:
							params['o'] = o - 1
							disp.Links.prev = disp.unparseQuery(params)
					return f()

			if 'p' in params:
				pageSize = int(params['p'][0])
			else:
				pageSize = thumbnailPageSize
				
			def getPage():
				if 'q' in params:
					try:
						ident,name,ctype,ignoretags,*is_comic = next(withtags.searchForTags(
							tags,
							offset=o,
							limit=1))
					except StopIteration:						
						if json:
							return []
						else:
							@prevnext
							def page():
								disp.Links.next = None
								pages.makePage('No Results Found',
								               pages.d.p('No Results Found'))
								return pages.derpage
							return page
					else:
						@prevnext
						def page():
							return disp.page(
								info.pageInfo(ident),path,params)
						return page
				else:
					if o:
						offset = pageSize*o
					else:
						offset = 0
						
					return disp.media(
						pathurl,
						params,
						o,
						pageSize,
						withtags.searchForTags(
							tags,
							offset=offset,
							limit=pageSize),
						withtags.searchForTags(
							tags,
							offset=offset,
#.........这里部分代码省略.........
开发者ID:cyisfor,项目名称:media-tagger,代码行数:103,代码来源:myserve.py

示例5: do_GET

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import tags [as 别名]
    def do_GET(self):
        Session.handler = self
        json,path,pathurl,params = parsePath(self.path)
        Session.params = params
        # Session.query = ...
        if len(path)>0 and len(path[0])>0 and path[0][0]=='~':
            mode = path[0][1:]
            page = dispatch(json,mode,path,params)
        else:
            implied = self.headers.get("X-Implied-Tags")                
            if implied:
                tags = tagsModule.parse(implied)
            else:
                tags = tagsModule.parse("-special:rl")
            tagfilter.filter(tags)
            tags.update(User.tags())
            basic = Taglist()
            # basic = visible tags to the user, i.e. not implied or user tags

            if json:
                disp = jsony
            else:
                disp = pages

            for thing in path:
                if thing:
                    thing = urllib.parse.unquote(thing)
                    if thing[0] == '-':
                        tag = tagsModule.getTag(thing[1:])
                        if tag:
                            tags.posi.discard(tag)
                            tags.nega.add(tag)
                            basic.nega.add(tag)
                        continue
                    elif thing[0] == '+':
                        thing = thing[1:]
                    tag = tagsModule.getTag(thing)
                    if tag:
                        tags.posi.add(tag)
                        basic.posi.add(tag)
            o = params.get('o')
            if 'q' in params:
                if o:
                    o = int(o[0],0x10)
                else:
                    o = 0
                ident,name,type,tags = next(withtags.searchForTags(tags,offset=o,limit=1))
                with disp.Links:
                    if json:
                        disp.Links.next = o + 1
                    else:
                        params['o'] = o + 1
                        disp.Links.next = disp.unparseQuery(params)
                    if o > 0:
                        if json:
                            disp.Links.prev = o - 1
                        else:
                            params['o'] = o - 1
                            disp.Links.prev = disp.unparseQuery(params) 
                    page = disp.page((ident,None,None,name,type,0,0,0,0,tags),path,params)
            else:
                if o:
                    o = int(o[0],0x10)
                    offset = thumbnailPageSize*o
                else:
                    offset = o = 0
                    
                page = disp.media(pathurl,params,o,
                        withtags.searchForTags(tags,offset=offset,limit=thumbnailPageSize),
                        withtags.searchForTags(tags,offset=offset,limit=thumbnailPageSize,wantRelated=True),basic)
        if json:
            page = jsony.encode(page).encode('utf-8')
        else:
            page = str(page).encode('utf-8')
        self.send_response(200,"OK")
        self.send_header('Content-Type',Session.type if Session.type else 'application/json' if json else 'text/html; charset=utf-8')
        if Session.modified:
            self.send_header('Last-Modified',self.date_time_string(float(Session.modified)))
        if not Session.head:
            self.send_header('Content-Length',len(page))
        else:
            self.send_header('Content-Length',0)
        if Session.refresh:
            if Session.refresh is True:
                Session.refresh = 5
            self.send_header('Refresh',str(Session.refresh))
        self.end_headers()
        if Session.head is False:
            self.wfile.write(page)
开发者ID:cyisfor,项目名称:media-tagger,代码行数:91,代码来源:serve.py


注:本文中的user.User.tags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。