Update Folders and Document apps to use the latest backup classes definitions
This commit is contained in:
@@ -53,12 +53,12 @@ class ElementBackupModel(ElementBackupBase):
|
||||
class ElementBackupFile(ElementBackupBase):
|
||||
label = _(u'File copy')
|
||||
|
||||
def __init__(self, storage_class, filepath):
|
||||
def __init__(self, storage_class, filepath=None):
|
||||
self.storage_class = storage_class
|
||||
self.filepath = filepath
|
||||
|
||||
def info(self):
|
||||
return _(u'%s from %s') % (self.filepath, self.storage_class)
|
||||
return _(u'%s from %s') % (self.filepath or _(u'all files'), self.storage_class)
|
||||
|
||||
def backup(self):
|
||||
"""
|
||||
@@ -166,7 +166,7 @@ class TestStorageModule(StorageModuleBase):
|
||||
print data
|
||||
print '***** saving to path: %s' % self.backup_path
|
||||
|
||||
def restore(self):-
|
||||
def restore(self):
|
||||
print 'restore from path: %s' % self.restore_path
|
||||
return 'sample_data'
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from django.core.urlresolvers import reverse
|
||||
|
||||
from permissions.models import Permission
|
||||
|
||||
from .api import AppBackup
|
||||
from .api import AppBackup, TestStorageModule
|
||||
#from .permissions import
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ def backup_view(request):
|
||||
{'name': _(u'info'), 'attribute': 'info'},
|
||||
],
|
||||
}
|
||||
|
||||
#ab = AppBackup.get_all()[0]
|
||||
#ab.backup(TestStorageModule(backup_path = '/tmp'))
|
||||
return render_to_response('generic_list.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
@@ -14,7 +14,7 @@ from history.permissions import PERMISSION_HISTORY_VIEW
|
||||
from project_setup.api import register_setup
|
||||
from acls.api import class_permissions
|
||||
from statistics.api import register_statistics
|
||||
from backups.api import AppBackup, ModelFixtures, DirectoryCopy
|
||||
from backups.api import AppBackup, ElementBackupModel, ElementBackupFile
|
||||
|
||||
from .models import (Document, DocumentPage,
|
||||
DocumentPageTransformation, DocumentType, DocumentTypeFilename,
|
||||
@@ -137,4 +137,4 @@ class_permissions(Document, [
|
||||
])
|
||||
|
||||
register_statistics(get_statistics)
|
||||
AppBackup('documents', _(u'Documents'), [ModelFixtures(), DirectoryCopy(document_settings.STORAGE_BACKEND)])
|
||||
AppBackup('documents', _(u'Documents'), [ElementBackupModel(), ElementBackupFile(document_settings.STORAGE_BACKEND)])
|
||||
|
||||
@@ -7,6 +7,7 @@ from navigation.api import (bind_links, register_top_menu,
|
||||
from documents.models import Document
|
||||
from acls.api import class_permissions
|
||||
from acls.permissions import ACLS_EDIT_ACL, ACLS_VIEW_ACL
|
||||
from backups.api import AppBackup, ElementBackupModel
|
||||
|
||||
from .models import Folder
|
||||
from .links import (folder_list, folder_create, folder_edit,
|
||||
@@ -42,3 +43,5 @@ class_permissions(Document, [
|
||||
PERMISSION_FOLDER_ADD_DOCUMENT,
|
||||
PERMISSION_FOLDER_REMOVE_DOCUMENT,
|
||||
])
|
||||
|
||||
AppBackup('folders', _(u'Folders'), [ElementBackupModel()])
|
||||
|
||||
Reference in New Issue
Block a user