summaryrefslogtreecommitdiff
path: root/bin/addons/base/module/wizard/move_module_wizard.py
diff options
context:
space:
mode:
authorHusen Daudi <hda@tinyerp.com>2007-05-02 08:39:16 +0000
committerHusen Daudi <hda@tinyerp.com>2007-05-02 08:39:16 +0000
commitce94cb92c2be6844d83a00721fb40c91e3339ac8 (patch)
treecd2d02a6bebf6148ca99661cd7c7765a50c8acbd /bin/addons/base/module/wizard/move_module_wizard.py
parent836368efcdb9faf51d8235e861363239c3617313 (diff)
Import/export module.zip
bzr revid: hda@tinyerp.com-ca86aecdd7c9e3e2a7c1d01e7b9185c5d22e5b89
Diffstat (limited to 'bin/addons/base/module/wizard/move_module_wizard.py')
-rw-r--r--bin/addons/base/module/wizard/move_module_wizard.py94
1 files changed, 94 insertions, 0 deletions
diff --git a/bin/addons/base/module/wizard/move_module_wizard.py b/bin/addons/base/module/wizard/move_module_wizard.py
new file mode 100644
index 00000000000..dee0df4bf1a
--- /dev/null
+++ b/bin/addons/base/module/wizard/move_module_wizard.py
@@ -0,0 +1,94 @@
+import wizard
+import osv
+from datetime import date
+import time
+import pooler
+import xmlrpclib
+import re
+import os
+import sys
+import string
+
+move_module_form = '''<?xml version="1.0"?>
+<form string="Transfer Module">
+ <field name="fromurl" colspan="4"/>
+ <newline/>
+ <label/>
+ <label> Give full path of Directory </label>
+ <newline/>
+ <field name="tourl" colspan="4"/>
+ <newline/>
+ <label/>
+ <label> Give full path with zip file name and .zip extension </label>
+</form>'''
+
+move_module_fields = {
+ 'fromurl': {'string':'Model Name', 'type':'char', 'size':128, 'required':True },
+ 'tourl': {'string':'Server URL', 'type':'char', 'size':128 , 'required':True},
+}
+finish_form ='''<?xml version="1.0"?>
+<form string="Finish">
+ <label string="Module Zipped successfully !!!" colspan="4"/>
+</form>
+'''
+
+class move_module_wizard(wizard.interface):
+ def createzip(self, cr, uid, data, context):
+ try:
+ fromurl = data['form']['fromurl']
+ tourl = data['form']['tourl'];
+ if (sys.platform.startswith('win')):
+ include_terp="pkzip -r '%s' %s -i \*terp*.*" % (tourl, ''.join(fromurl))
+ exclude_py="pkzip -r '%s' %s -x \*.py \*.svn*" % (tourl, ''.join(fromurl))
+ elif (sys.platform.startswith('linux')):
+ include_terp="zip -r '%s' %s -i \*terp*.*" % (tourl, ''.join(fromurl))
+ exclude_py="zip -r '%s' %s -x \*.py \*.svn*" % (tourl, ''.join(fromurl))
+
+ if os.system(include_terp) == 0:
+ print 'Successful backup to', tourl
+ else:
+ print 'Backup FAILED'
+
+ if os.system(exclude_py) == 0:
+ print 'Successful backup to', tourl
+ else:
+ print 'Backup FAILED'
+
+ except Exception,e:
+
+ if hasattr(e,'args'):
+ print "Items::",e.args;
+ if len(e.args) == 2:
+ if e.args[0] == -2:
+ return 'wrong_server_name'
+ #end if e.args[0] == -2:
+ else:
+ return 'wrong_server_name'
+ #end if len(e.args) == 2:
+ #end if hasattr(e,'args'):
+
+ return 'wrong_server_name'
+ return 'finish'
+
+ #end def createzip(self, cr, uid, data, context):
+
+
+ def _init_wizard(self, cr, uid, data, context):
+ return {'fromurl':'/home/admin/Desktop/project','tourl':'/home/admin/Desktop/supportzip/myzip.zip'}
+
+
+ states = {
+ 'init': {
+ 'actions': [_init_wizard],
+ 'result': {'type':'form', 'arch':move_module_form, 'fields':move_module_fields, 'state':[('end','Cancel'),('makezip','Create Zip')]}
+ },
+ 'makezip': {
+ 'actions': [],
+ 'result':{'type':'choice', 'next_state': createzip}
+ },
+ 'finish':{
+ 'actions': [],
+ 'result':{'type':'form', 'arch':finish_form,'fields':{},'state':[('end','OK')]}
+ }
+ }
+move_module_wizard('tmp.wizard')