示例#1
0
文件: content.py 项目: buxx/tracim
 def update_file_data(self, item: Content, new_filename: str, new_mimetype: str, new_file_content) -> Content:
     item.owner = self._user
     item.file_name = new_filename
     item.file_mimetype = new_mimetype
     item.file_content = new_file_content
     item.revision_type = ActionDescription.REVISION
     return item
示例#2
0
 def update_file_data(self, item: Content, new_filename: str,
                      new_mimetype: str, new_file_content) -> Content:
     item.owner = self._user
     item.file_name = new_filename
     item.file_mimetype = new_mimetype
     item.file_content = new_file_content
     item.revision_type = ActionDescription.REVISION
     return item
示例#3
0
 def update_file_data(self, item: Content, new_filename: str, new_mimetype: str, new_content: bytes) -> Content:
     item.owner = self._user
     item.file_name = new_filename
     item.file_mimetype = new_mimetype
     item.depot_file = FileIntent(
         new_content,
         new_filename,
         new_mimetype,
     )
     item.revision_type = ActionDescription.REVISION
     return item
示例#4
0
 def update_file_data(self, item: Content, new_filename: str, new_mimetype: str, new_content: bytes) -> Content:
     item.owner = self._user
     item.file_name = new_filename
     item.file_mimetype = new_mimetype
     item.depot_file = FileIntent(
         new_content,
         new_filename,
         new_mimetype,
     )
     item.revision_type = ActionDescription.REVISION
     return item
示例#5
0
    def test_sort_by_label_or_filename(self):
        c1 = Content()
        c1.label = 'ABCD'
        c1.type = 'file'

        c2 = Content()
        c2.label = ''
        c2.type = 'file'
        c2.file_name = 'AABC'

        c3 = Content()
        c3.label = 'BCDE'
        c3.type = 'file'

        items = [c1, c2, c3]
        sorteds = ContentApi.sort_content(items)

        eq_(sorteds[0], c2)
        eq_(sorteds[1], c1)
        eq_(sorteds[2], c3)
示例#6
0
    def test_sort_by_label_or_filename(self):
        c1 = Content()
        c1.label = 'ABCD'
        c1.type = 'file'

        c2 = Content()
        c2.label = ''
        c2.type = 'file'
        c2.file_name = 'AABC'

        c3 = Content()
        c3.label = 'BCDE'
        c3.type = 'file'

        items = [c1, c2, c3]
        sorteds = ContentApi.sort_content(items)

        eq_(sorteds[0], c2)
        eq_(sorteds[1], c1)
        eq_(sorteds[2], c3)