Skip to content

Commit e243fe1

Browse files
committed
WIP: browser view to test and develop the script
avoid restarting the instance all the time.
1 parent 08befc5 commit e243fe1

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

opengever/maintenance/browser/configure.zcml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,11 @@
104104
permission="cmf.ManagePortal"
105105
/>
106106

107+
<browser:page
108+
for="*"
109+
name="repository_analyse"
110+
class=".repository_analyser.RepositoryAnalyser"
111+
permission="cmf.ManagePortal"
112+
/>
113+
107114
</configure>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from Products.Five.browser import BrowserView
2+
from opengever.maintenance.scripts.repository_migration_analyse import RepositoryExcelAnalyser
3+
from opengever.maintenance.scripts.repository_migration_analyse import RepositoryMigrator
4+
5+
6+
class RepositoryAnalyser(BrowserView):
7+
"""Test view for the analyser, easier/faster than a script.
8+
"""
9+
10+
def __call__(self):
11+
self.diff_xlsx_path = '/Users/flipsi/Documents/GEVER/SG/hba_migration/hba_os_migration.xlsx'
12+
self.analyse_xlsx_path = '/Users/flipsi/Documents/GEVER/SG/hba_migration/analyse.xlsx'
13+
14+
import transaction
15+
# transaction.doom()
16+
17+
from plone.protect.interfaces import IDisableCSRFProtection
18+
from zope.interface import alsoProvides
19+
alsoProvides(self.request, IDisableCSRFProtection)
20+
analyser = RepositoryExcelAnalyser(self.diff_xlsx_path,
21+
self.analyse_xlsx_path)
22+
analyser.analyse()
23+
analyser.export_to_excel()
24+
25+
migrator = RepositoryMigrator(analyser.analysed_rows)
26+
migrator.run()
27+
28+
return 'DONE'

0 commit comments

Comments
 (0)