コード例 #1
0
ファイル: TestFaculty.py プロジェクト: tfausak/class
 def test_addRetrieveArticle(self):
     article = F.addArticle("Psychology in the Lab", "47000")
     self.assert_(article.journal == "Psychology in the Lab" and article.edition == "47000")
     db.put(article)
     key = article.key()
     article = db.get(key)
     self.assert_(article.journal == "Psychology in the Lab" and article.edition == "47000")
コード例 #2
0
ファイル: Import.py プロジェクト: saadfsti/class
		def put_writings(person_handle, writings):
			"""
			makes DB Writing objects, associating them with their person
		
			Keyword arguments:
			person_handle -- person that owns these courses
			writings -- list of writings to associate with person
		
			no return
			"""
			for writing in writings:
				title = get_text(writing.find('title'))
				w_type = get_text(writing.find('writing'))
		
				publish_info_list = []
				publish_infos = writing.findall('publish_info')
				for publish_info in publish_infos:
					if publish_info is not None: 
						publisher = get_text(publish_info.find('publisher'))
						publish_date = get_text(publish_info.find('publish_date'))
						article = publish_info.find('article')
						if article is not None:
							journal = get_text(article.find('journal'))
							edition = get_text(article.find('edition'))
							article = Faculty3.addArticle(journal, edition)
						isbn = publish_info.find('isbn')
						if isbn is not None:
							isbn = get_text(isbn)
						publish_info_list.append(Faculty3.addPublishInfo(publisher, publish_date, isbn, article))
				authors = writing.findall('author')
				author_list = put_names(authors)
		
				writing = Faculty3.addWriting(title, w_type, author_list, publish_info_list)
				Faculty3.associatePersonWithWriting(person_handle, writing)
コード例 #3
0
ファイル: TestFaculty.py プロジェクト: tfausak/class
    def test_addRetrievePublishInfo(self):
        article = F.addArticle("Psychology in the Lab", "47000")
        db.put(article)

        publish = F.addPublishInfo("Borders", "1/1/2010", "ISBN1234", article)

        self.assert_(publish.publisher == "Borders" and publish.date == "1/1/2010" and publish.isbn == "ISBN1234")
        self.assert_(publish.article.journal == "Psychology in the Lab" and publish.article.edition == "47000")

        key = publish.key()

        publish = db.get(key)

        self.assert_(publish.publisher == "Borders" and publish.date == "1/1/2010" and publish.isbn == "ISBN1234")
        self.assert_(publish.article.journal == "Psychology in the Lab" and publish.article.edition == "47000")
コード例 #4
0
        def put_writings(person_handle, writings):
            """
			makes DB Writing objects, associating them with their person
		
			Keyword arguments:
			person_handle -- person that owns these courses
			writings -- list of writings to associate with person
		
			no return
			"""
            for writing in writings:
                title = get_text(writing.find('title'))
                w_type = get_text(writing.find('writing'))

                publish_info_list = []
                publish_infos = writing.findall('publish_info')
                for publish_info in publish_infos:
                    if publish_info is not None:
                        publisher = get_text(publish_info.find('publisher'))
                        publish_date = get_text(
                            publish_info.find('publish_date'))
                        article = publish_info.find('article')
                        if article is not None:
                            journal = get_text(article.find('journal'))
                            edition = get_text(article.find('edition'))
                            article = Faculty3.addArticle(journal, edition)
                        isbn = publish_info.find('isbn')
                        if isbn is not None:
                            isbn = get_text(isbn)
                        publish_info_list.append(
                            Faculty3.addPublishInfo(publisher, publish_date,
                                                    isbn, article))
                authors = writing.findall('author')
                author_list = put_names(authors)

                writing = Faculty3.addWriting(title, w_type, author_list,
                                              publish_info_list)
                Faculty3.associatePersonWithWriting(person_handle, writing)