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


Python Session.setUser方法代码示例

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


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

示例1: handle

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import setUser [as 别名]
	def handle(self):
		
		db = self.__db
		cursor = self.__cursor
		
		form = cgi.FieldStorage(keep_blank_values="True")
		
		uHandler = UserHandler(db, cursor)
		
		#print "Content-type:text/html"		# TEMPORARY, REMOVE AFTER DEBUGGING TO HAVE SCRIPT REDIRECT PROPERLY!!!!!!
		#print					# DITTO
		#print `form`
		
		if form.has_key("username"):
			# store the user ID for use throughout the session; add to other views in addition to create in PHP
			currUname = form.getvalue("username")
			currUser = uHandler.getUserByDescription(currUname)
			Session.setUser(currUser)
				
		elif form.has_key("curr_user_id"):
			currUID = form.getvalue("curr_user_id")
			currUser = uHandler.getUserByID(currUID)
			Session.setUser(currUser)		
		
		if form.has_key("create_project"):
			self.createProject(form)
		
		elif form.has_key("modify_project"):
			self.modifyProject(form)
		
		elif form.has_key("save_project"):
			self.saveProject(form)
		
		elif form.has_key("cancel_project"):
			self.cancelModification(form)

		elif form.has_key("delete_project"):
			self.deleteProject(form)
			
		elif form.has_key("view_project"):
			self.printProjectInfo(form)
			
		elif form.has_key("view_packet"):
			# go to project view from User detailed view
			self.viewPacket(form)
			
		# Oct. 12, 2010
		elif form.has_key("search_project_by_keyword"):
			self.findPacket(form)

		cursor.close()
		db.close()
开发者ID:mbikyaw,项目名称:OpenFreezer,代码行数:54,代码来源:project_request_handler.py

示例2: handle

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import setUser [as 别名]
    def handle(self):

        db = self.__db
        cursor = self.__cursor
        hostname = self.__hostname

        mail_server = self.__mail_server  # August 19, 2011
        mail_admin = self.__mail_admin  # August 19, 2011

        clone_request = self.__clone_request

        form = cgi.FieldStorage(keep_blank_values="True")

        uHandler = UserHandler(db, cursor)

        # print "Content-type:text/html"		# TEMPORARY, REMOVE AFTER DEBUGGING TO HAVE SCRIPT REDIRECT PROPERLY!!!!!!
        # print					# DITTO
        # print `form`

        if form.has_key("curr_username"):
            # store the user ID for use throughout the session; add to other views in addition to create in PHP
            currUname = form.getvalue("curr_username")
            currUser = uHandler.getUserByDescription(currUname)

            Session.setUser(currUser)

        elif form.has_key("curr_user_id"):
            currUID = form.getvalue("curr_user_id")
            currUser = uHandler.getUserByID(currUID)
            Session.setUser(currUser)

        if form.has_key("add_user"):
            self.addUser(form)

        elif form.has_key("modify_user"):
            self.modifyUser(form)

        elif form.has_key("cancel_user"):
            self.cancelUserModification(form)

        elif form.has_key("save_user"):
            self.saveUser(form)

        elif form.has_key("delete_user"):
            self.deleteUser(form)

        elif (
            form.has_key("view_user")
            and form.getvalue("view_user") != ""
            and not form.has_key("modify_lab")
            and not form.has_key("delete_lab")
        ):
            self.viewUser(form)

            # Nov. 17/07 - Personal user page
        elif (
            form.has_key("view_user")
            and form.getvalue("view_user") == ""
            and not form.has_key("modify_lab")
            and not form.has_key("delete_lab")
        ):
            self.printUserInfo("view", currUser)

        elif form.has_key("add_lab"):
            self.addLab(form)

        elif form.has_key("view_lab"):
            self.viewLab(form)

        elif form.has_key("modify_lab"):
            self.modifyLab(form)

        elif form.has_key("save_lab"):
            self.saveLab(form)

        elif form.has_key("cancel_lab"):
            self.cancelLabModification(form)

        elif form.has_key("delete_lab"):
            self.deleteLab(form)

        elif form.has_key("bug_report"):
            self.submitBug(form)

        elif form.has_key("send_order"):

            ######################################################################
            # CHANGE SERVER NAME AND EMAIL TO YOUR LOCAL CREDENTIALS
            ######################################################################

            userID = form.getvalue("curr_user_id")
            userDescr = form.getvalue("curr_username")

            from_email = uHandler.findEmail(userID)

            if not from_email:
                from_email = userDescr

            to_email = clone_request

#.........这里部分代码省略.........
开发者ID:mbikyaw,项目名称:OpenFreezer,代码行数:103,代码来源:user_request_handler.py

示例3: update

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import setUser [as 别名]
def update():

	dbConn = DatabaseConn()
	db = dbConn.databaseConnect()
	
	cursor = db.cursor()
	hostname = dbConn.getHostname()

	form = cgi.FieldStorage(keep_blank_values="True")
	
	print "Content-type:text/html"		# REMOVE AFTER DEBUGGING TO HAVE SCRIPT REDIRECT PROPERLY!!!!!!
	print					# DITTO
	#print `form`

	# Aug 29/07
	uHandler = UserHandler(db, cursor)
	
	if form.has_key("curr_username"):
		# store the user ID for use throughout the session; add to other views in addition to create in PHP
		currUname = form.getvalue("curr_username")
		currUser = uHandler.getUserByDescription(currUname)
		
		Session.setUser(currUser)
		
	#else:	# debug
		#currUname = 'Administrator'
		#currUser = uHandler.getUserByDescription(currUname)
		
		#Session.setUser(currUser)
		
	if form.has_key("cloning_method"):
		cloning_method = form.getvalue("cloning_method")
	
	#else:	# debug
		#cloning_method = '1'
		
	# Handlers and mappers
	rHandler = ReagentHandler(db, cursor)
	#sHandler = SystemSetHandler(db, cursor)
	pHandler = ReagentPropertyHandler(db, cursor)
	raHandler = ReagentAssociationHandler(db, cursor)
	aHandler = AssociationHandler(db, cursor)

	dnaHandler = DNAHandler(db, cursor)
	commHandler = CommentHandler(db, cursor)
	protHandler = ProteinHandler(db, cursor)	
	
	propMapper = ReagentPropertyMapper(db, cursor)
	assocMapper = ReagentAssociationMapper(db, cursor)

	# August 29/07: Restrict creation by user and project access
	packetHandler = ProjectDatabaseHandler(db, cursor)

	########################################################
	# Various maps
	########################################################

	prop_Alias_ID_Map = propMapper.mapPropAliasID()		# (propAlias, propID) - e.g. ('insert_type', '48') --> represents 'type of insert' property
	prop_Name_Alias_Map = propMapper.mapPropNameAlias()	# (propName, propAlias)
	prop_Name_ID_Map = propMapper.mapPropNameID()		# (prop name, prop id)

	
	# Restriction sites
	fpcs_prop_id = pHandler.findPropID("5' cloning site")
	tpcs_prop_id = pHandler.findPropID("3' cloning site")

	newFivePrime = form.getvalue("fpcs")
	newThreePrime = form.getvalue("tpcs")

	gatewaySites = ['attb', 'attl', 'attp', 'attr']		# nov. 16/07
	
	# resulting sequence
	newSeq = ""

	# Fetch projects the user has AT LEAST Read access to (i.e. if he is explicitly declared a Writer on a project but not declared a Reader, include that project, plus all public projects)
	currReadProj = packetHandler.findMemberProjects(currUser.getUserID(), 'Reader')
	currWriteProj = packetHandler.findMemberProjects(currUser.getUserID(), 'Writer')
	publicProj = packetHandler.findAllProjects(isPrivate="FALSE")
	
	# list of Packet OBJECTS
	currUserWriteProjects = utils.unique(currReadProj + currWriteProj + publicProj)
	
	uPackets = []
	
	for p in currUserWriteProjects:
		uPackets.append(p.getNumber())

	# Get project IDs of parents
	packetPropID = pHandler.findPropID("packet id")

		
	# August 29/07: Need to verify parent project access AND (Sept. 12/07) reconstruct the sequence IFF parent values are changed
	newSeq = ""
	
	# Fetch projects the user has AT LEAST Read access to (i.e. if he is explicitly declared a Writer on a project but not declared a Reader, include that project, plus all public projects)
	currReadProj = packetHandler.findMemberProjects(currUser.getUserID(), 'Reader')
	currWriteProj = packetHandler.findMemberProjects(currUser.getUserID(), 'Writer')
	publicProj = packetHandler.findAllProjects(isPrivate="FALSE")
	
	# list of Packet OBJECTS
#.........这里部分代码省略.........
开发者ID:rjeschmi,项目名称:OpenFreezer,代码行数:103,代码来源:vector_sequence.py


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