Пример #1
0
 def new_person(self, *arguments, **keywords):
     """Return a Person object."""
     # XXX: not really useful...
     if keywords.has_key('name'):
         if not isinstance(keywords['name'], UnicodeType):
             keywords['name'] = unicode(keywords['name'],
                                         encoding, 'replace')
     elif len(arguments) > 1:
         if not isinstance(arguments[1], UnicodeType):
             arguments[1] = unicode(arguments[1], encoding, 'replace')
     return Person.Person(accessSystem=self.accessSystem,
                             *arguments, **keywords)
Пример #2
0
 def new_person(self, *arguments, **keywords):
     """Return a Person object."""
     # XXX: not really useful...
     if 'name' in keywords:
         if not isinstance(keywords['name'], str):
             keywords['name'] = str(keywords['name'], encoding, 'replace')
     elif len(arguments) > 1:
         if not isinstance(arguments[1], str):
             arguments[1] = str(arguments[1], encoding, 'replace')
     return Person.Person(accessSystem=self.accessSystem,
                          *arguments,
                          **keywords)
Пример #3
0
    def search_person(self, name, results=None):
        """Return a list of Person objects for a query for the given name.

        The results argument is the maximum number of results to return."""
        if results is None:
            results = self._results
        try:
            results = int(results)
        except (ValueError, OverflowError):
            results = 20
        res = self._search_person(name, results)
        return [Person.Person(personID=self._get_real_personID(pi),
                data=pd, modFunct=self._defModFunct,
                accessSystem=self.accessSystem) for pi, pd in res][:results]
Пример #4
0
    def get_person(self, personID, info=Person.Person.default_info, modFunct=None):
        """Return a Person object for the given personID.

        The personID is something used to univocally identify a person;
        it can be the imdbID used by the IMDb web server, a file
        pointer, a line number in a file, an ID in a database, etc.

        info is the list of sets of information to retrieve.

        If specified, modFunct will be the function used by the Person
        object when accessing its text fields (like 'mini biography')."""
        personID = self._normalize_personID(personID)
        personID = self._get_real_personID(personID)
        person = Person.Person(personID=personID, accessSystem=self.accessSystem)
        modFunct = modFunct or self._defModFunct
        if modFunct is not None:
            person.set_mod_funct(modFunct)
        self.update(person, info)
        return person
Пример #5
0
 def new_person(self, *arguments, **keywords):
     """Return a Person object."""
     # XXX: not really useful...
     return Person.Person(accessSystem=self.accessSystem,
                          *arguments,
                          **keywords)