- #folder = unicode(selsettings.EXPORTER_BACKUP_STORAGE)
-
- #for f in os.listdir(folder):
- # if (not os.path.isdir(os.path.join(folder, f))) and f.endswith('.tar.gz'):
- # try:
- # tar = tarfile.open(os.path.join(folder, f), "r")
- # inf = ConfigParser.SafeConfigParser()
- # inf.readfp(tar.extractfile('backup.inf'))
- #
- # if inf.get(DATE_AND_AUTHOR_INF_SECTION, 'site') == settings.APP_URL:
- # available.append({
- # 'author': User.objects.get(id=inf.get(DATE_AND_AUTHOR_INF_SECTION, 'author')),
- # 'date': datetime.strptime(inf.get(DATE_AND_AUTHOR_INF_SECTION, 'finished'), )
- # })
- # except Exception, e:
- # pass
+ folder = unicode(selsettings.EXPORTER_BACKUP_STORAGE)
+
+ for f in os.listdir(folder):
+ if (not os.path.isdir(os.path.join(folder, f))) and f.endswith('.backup.inf'):
+ try:
+ with open(os.path.join(folder, f), 'r') as inffile:
+ inf = ConfigParser.SafeConfigParser()
+ inf.readfp(inffile)
+
+ if inf.get(DATE_AND_AUTHOR_INF_SECTION, 'site') == settings.APP_URL and os.path.exists(
+ os.path.join(folder, inf.get(DATE_AND_AUTHOR_INF_SECTION, 'file-name'))):
+ available.append({
+ 'author': User.objects.get(id=inf.get(DATE_AND_AUTHOR_INF_SECTION, 'author')),
+ 'date': datetime.datetime.strptime(inf.get(DATE_AND_AUTHOR_INF_SECTION, 'finished'), DATETIME_FORMAT)
+ })
+ except Exception, e:
+ pass