Ejemplo n.º 1
0
    def __init__(self, identifier, uri, name, type):
        if identifier is None:
            self.identifier = DBRepository.id_counter
            DBRepository.id_counter += 1
        else:
            self.identifier = identifier

        self.uri = to_unicode(uri)
        self.name = to_unicode(name)
        self.type = to_unicode(type)
Ejemplo n.º 2
0
    def __init__(self, identifier, uri, name, type):
        if identifier is None:
            self.identifier = DBRepository.id_counter
            DBRepository.id_counter += 1
        else:
            self.identifier = identifier

        self.uri = to_unicode(uri)
        self.name = to_unicode(name)
        self.type = to_unicode(type)
Ejemplo n.º 3
0
    def __init__(self, identifier, commit):
        if identifier is None:
            self.identifier = DBLog.id_counter
            DBLog.id_counter += 1
        else:
            self.identifier = identifier

        self.rev = to_unicode(commit.revision)
        self.committer = None
        self.author = None
        self.date = commit.date
        self.date_tz = commit.date_tz
        self.author_date = commit.author_date
        self.author_date_tz = commit.author_date_tz
        self.message = to_unicode(commit.message)
        self.composed_rev = commit.composed_rev
Ejemplo n.º 4
0
    def __init__(self, identifier, commit):
        if identifier is None:
            self.identifier = DBLog.id_counter
            DBLog.id_counter += 1
        else:
            self.identifier = identifier

        self.rev = to_unicode(commit.revision)
        self.committer = None
        self.author = None
        self.date = commit.date
        self.date_tz = commit.date_tz
        self.author_date = commit.author_date
        self.author_date_tz = commit.author_date_tz
        self.message = to_unicode(commit.message)
        self.composed_rev = commit.composed_rev
Ejemplo n.º 5
0
    def __init__(self, identifier, name):
        if identifier is None:
            self.identifier = DBTag.id_counter
            DBTag.id_counter += 1
        else:
            self.identifier = identifier

        self.name = to_unicode(name)
Ejemplo n.º 6
0
    def __init__(self, identifier, name):
        if identifier is None:
            self.identifier = DBTag.id_counter
            DBTag.id_counter += 1
        else:
            self.identifier = identifier

        self.name = to_unicode(name)
Ejemplo n.º 7
0
 def _get_file_contents(self):
     """Returns contents of the file, stripped of whitespace 
         at either end
         """
     # An encode will fail if the source code can't be converted to
     # unicode, ie. it's not already utf-8, or latin-1, or something
     # obvious. This almost always means that the file isn't source
     # code at all.
     return to_unicode(self._file_contents)
Ejemplo n.º 8
0
    def __init__(self, identifier, file_name):
        if identifier is None:
            self.identifier = DBFile.id_counter
            DBFile.id_counter += 1
        else:
            self.identifier = identifier

        self.file_name = to_unicode(file_name)
        self.repository_id = None
Ejemplo n.º 9
0
    def __init__(self, identifier, person):
        if identifier is None:
            self.identifier = DBPerson.id_counter
            DBPerson.id_counter += 1
        else:
            self.identifier = identifier

        self.name = to_unicode(person.name)
        self.email = person.email or None
Ejemplo n.º 10
0
 def _get_file_contents(self):
         """Returns contents of the file, stripped of whitespace 
         at either end
         """
         # An encode will fail if the source code can't be converted to
         # unicode, ie. it's not already utf-8, or latin-1, or something
         # obvious. This almost always means that the file isn't source
         # code at all. 
         return to_unicode(self._file_contents)
Ejemplo n.º 11
0
    def __init__(self, identifier, file_name):
        if identifier is None:
            self.identifier = DBFile.id_counter
            DBFile.id_counter += 1
        else:
            self.identifier = identifier

        self.file_name = to_unicode(file_name)
        self.repository_id = None
Ejemplo n.º 12
0
    def __init__(self, identifier, person):
        if identifier is None:
            self.identifier = DBPerson.id_counter
            DBPerson.id_counter += 1
        else:
            self.identifier = identifier

        self.name = to_unicode(person.name)
        self.email = person.email or None
Ejemplo n.º 13
0
 def testLatin1String(self):
     latin1String = "Hell\xf3 W\xe4rld"
     self.assertEqual (u"Helló Wärld", utils.to_unicode(latin1String))
Ejemplo n.º 14
0
 def testAsciiString(self):
     asciiString = "HelloWorld"
     self.assertEqual (u"HelloWorld", utils.to_unicode(asciiString))
Ejemplo n.º 15
0
 def testUtf8String(self):
     utf8String = "\xC3\x96\xE1\x9B\x96\x61"
     self.assertEqual (u"\u00d6\u16d6a", utils.to_unicode(utf8String))
Ejemplo n.º 16
0
 def testUnicode(self):
     self.assertEqual (u"Hello World", utils.to_unicode(u"Hello World"))