示例#1
0
 def synchronize(self, path):
     """
     compare files on didel with file in folder,
         and calling download add or reset files'user
         only if not exist or older
     """
     path = "%s/%s" % (path, self.ref)
     mkdir_p(path)
     for k, resource in self._resources.items():
         if isinstance(resource, CourseDocuments):
             resource.synchronize("%s/%s" % (path, k))
         else:
             no_file = not os.path.exists("%s/%s" % (path, k))
             didel_time = date2timestamp(resource.date)
             if no_file or didel_time > file_mtime("%s/%s" % (path, k)):
                 self.download(resource, path)
示例#2
0
 def synchronize(self, path):
     """
     compare files on didel with file in folder,
         and calling download add or reset files'user
         only if not exist or older
     """
     path = "%s/%s" % (path, self.ref)
     mkdir_p(path)
     for k, resource in self._resources.items():
         if isinstance(resource, CourseDocuments):
             resource.synchronize("%s/%s" % (path, k))
         else:
             no_file = not os.path.exists("%s/%s" % (path, k))
             didel_time = date2timestamp(resource.date)
             if no_file or didel_time > file_mtime("%s/%s" % (path, k)):
                 self.download(resource, path)
示例#3
0
 def test_date2timestamp_good_date(self):
     d1 = date2timestamp("29.01.2015", 43)
     d2 = date2timestamp("28.02.2015", 42)
     self.assertLess(d1, d2)
示例#4
0
 def test_date2timestamp_good_format_bad_date_42(self):
     self.assertEquals(42, date2timestamp("31.02.2014", 42))
示例#5
0
 def test_date2timestamp_good_format_bad_date(self):
     self.assertEquals(0, date2timestamp("31.02.2014", 0))
示例#6
0
 def test_date2timestamp_wrong_format_default_0(self):
     self.assertEquals(0, date2timestamp("", 0))
     self.assertEquals(0, date2timestamp("some text", 0))
     self.assertEquals(0, date2timestamp("3.14", 0))
示例#7
0
 def test_date2timestamp_good_date(self):
     d1 = date2timestamp("29.01.2015", 43)
     d2 = date2timestamp("28.02.2015", 42)
     self.assertLess(d1, d2)
示例#8
0
 def test_date2timestamp_good_format_bad_date_42(self):
     self.assertEquals(42, date2timestamp("31.02.2014", 42))
示例#9
0
 def test_date2timestamp_good_format_bad_date(self):
     self.assertEquals(0, date2timestamp("31.02.2014", 0))
示例#10
0
 def test_date2timestamp_wrong_format_default_0(self):
     self.assertEquals(0, date2timestamp("", 0))
     self.assertEquals(0, date2timestamp("some text", 0))
     self.assertEquals(0, date2timestamp("3.14", 0))