def test_get_recursive_path(self):
     root = DummyFolder().create_dummy_root_folder()
     f2 = DummyFolder().create_dummy_folder(parent=root)
     f3 = DummyFolder().create_dummy_folder(parent=f2)
     report = DummyFolder().create_dummy_report(parent=f3)
     patt = os.path.join('%s', '%s', '%s', '')
     expected = patt % (root.id, f2.id, f3.id)
     self.assertEqual(get_recursive_path(report), expected)
 def test_get_recursive_path(self):
     root = DummyFolder().create_dummy_root_folder()
     f2 = DummyFolder().create_dummy_folder(parent=root)
     f3 = DummyFolder().create_dummy_folder(parent=f2)
     report = DummyFolder().create_dummy_report(parent=f3)
     patt = os.path.join('%s',
                         '%s',
                         '%s',
                         '')
     expected = patt % (root.id, f2.id, f3.id)
     self.assertEqual(get_recursive_path(report), expected)
Ejemplo n.º 3
0
 def clear_files(self, request, queryset):
     i = 0
     print('%6s %6s %10s %s' % ('id', 'parent', 'path', 'file'))
     for obj in queryset:
         try:
             print('%6s %6s %10s %s' % (obj.id, obj.parent.id, get_recursive_path(obj), obj.file))
             obj.file.delete()
             obj.save()
             i += 1
         except:
             pass
     if i == 1:  message_bit = "%s object was" % i
     else:       message_bit = "%s objects were" % i
     self.message_user(request, "%s successfully updated." % message_bit)
Ejemplo n.º 4
0
 def clear_files(self, request, queryset):
     i = 0
     print('%6s %6s %10s %s' % ('id', 'parent', 'path', 'file'))
     for obj in queryset:
         try:
             print(
                 '%6s %6s %10s %s' %
                 (obj.id, obj.parent.id, get_recursive_path(obj), obj.file))
             obj.file.delete()
             obj.save()
             i += 1
         except:
             pass
     if i == 1: message_bit = "%s object was" % i
     else: message_bit = "%s objects were" % i
     self.message_user(request, "%s successfully updated." % message_bit)