示例#1
0
文件: Import.py 项目: saadfsti/class
		def put_person(person):
			"""
			pulls xml 'name',  'email', 'username', and 'title' or 'status'
			from 'person', makes DB Faculty or Student Object
		
			Keyword arguments:
			person -- xml person tag
		
			return reference to DB Faculty or Student object
			"""
		
			assert person.tag == 'faculty' or person.tag == 'student'
		
			name = put_name(person.find('name'))
		
			username = None
			if person.find('username') is not None:
				username = person.find('username').text
		
			emails = person.findall('email')
			emails = [email.text for email in emails]
		
			if person.tag == 'faculty':
				title = get_text(person.find('title'))
				person_handle = Faculty4.addFaculty(name, emails, title, username)
			elif person.tag == 'student':
				status = get_text(person.find('status'))
				person_handle = Faculty4.addStudent(name, emails, status, username)
		
			return person_handle
示例#2
0
文件: Import.py 项目: saadfsti/class
		def put_advisees(person_handle, advisees):
			for advisee in advisees:
				name = put_name(advisee.find('name'))
				email = get_text(advisee.find('email'))
				status = get_text(advisee.find('status'))
		
				username = advisee.find('username')
				if username is not None:
					username = get_text(username)
		
				advisee = Faculty4.addStudent(name, [email], status, username, advisors = person_handle)