diff options
| author | ced <> | 2007-07-30 13:34:59 +0000 |
|---|---|---|
| committer | ced <> | 2007-07-30 13:34:59 +0000 |
| commit | 5d2d3a07f217d829b687965a7d8d7b52389a9df5 (patch) | |
| tree | 926963242ae88d7ff233e007115e6c7875b2b1c9 /addons/base_module_publish/wizard/base_module_publish.py | |
| parent | de25bb420ad5b8c9aaafb00dfc17db27abdb4a32 (diff) | |
base, base_module_publish, kernel: improve module publication
- allow including source
- fix GPL-2
- module are active=False by default
- add license in module object
bzr revid: ced-841334c96cd7b358eb44970adbde75b2bc7b971e
Diffstat (limited to 'addons/base_module_publish/wizard/base_module_publish.py')
| -rw-r--r-- | addons/base_module_publish/wizard/base_module_publish.py | 129 |
1 files changed, 71 insertions, 58 deletions
diff --git a/addons/base_module_publish/wizard/base_module_publish.py b/addons/base_module_publish/wizard/base_module_publish.py index 1cfaab61815..8fe4422e8aa 100644 --- a/addons/base_module_publish/wizard/base_module_publish.py +++ b/addons/base_module_publish/wizard/base_module_publish.py @@ -41,14 +41,15 @@ intro_form = '''<?xml version="1.0"?> </form>''' intro_fields = { - 'text': {'string':'Introduction', 'type':'text', 'readonly':True, 'default': lambda *args: """ + 'text': {'string':'Introduction', 'type':'text', 'readonly':True, + 'default': lambda *args: """ This system will automatically publish the selected module to the Tiny ERP official website. You can use it to quickly publish a new module or update an existing one (new version). Make sure you read the publication manual and modules guidelines before continuing: - http://tinyerp.com + http://www.tinyerp.com Thank you for contributing ! """}, @@ -67,59 +68,69 @@ check_form = '''<?xml version="1.0"?> <form string="Module publication"> <separator string="Verify your module information" colspan="4"/> <notebook> - <page string="General"> - <field name="name"/> - <field name="version"/> - <field name="author"/> - <field name="website" widget="url"/> - <field name="shortdesc"/> - <field name="operation"/> - <field name="category"/> - <field name="licence"/> - <field name="url_download"/> - <label colspan="2" string="(Keep empty for an auto upload of the module)"/> - <field name="docurl"/> <label colspan="2" string="(empty to keep existing value)"/> - <field name="demourl"/> <label colspan="2" string="(empty to keep existing value)"/> - <field name="image"/> <label colspan="2" string="(support only .png files)"/> - </page><page string="Description"> - <field name="description" colspan="4" nolabel="1"/> - </page> + <page string="General"> + <field name="name"/> + <field name="version"/> + <field name="author"/> + <field name="website" widget="url"/> + <field name="shortdesc"/> + <field name="operation"/> + <field name="category" colspan="4"/> + <newline/> + <field name="license"/> + <field name="include_src"/> + <newline/> + <field name="url_download" colspan="4" widget="url"/> + <field name="docurl" colspan="4" widget="url"/> + <field name="demourl" colspan="4" widget="url"/> + <field name="image"/> + </page> + <page string="Description"> + <field name="description" colspan="4" nolabel="1"/> + </page> </notebook> </form>''' check_fields = { 'name': {'string':'Name', 'type':'char', 'size':64, 'readonly':True}, - 'shortdesc': {'string':'Small description', 'type':'char', 'size':200, 'readonly':True}, + 'shortdesc': {'string':'Small description', 'type':'char', 'size':200, + 'readonly':True}, 'author': {'string':'Author', 'type':'char', 'size':128, 'readonly':True}, 'website': {'string':'Website', 'type':'char', 'size':200, 'readonly':True}, 'url': {'string':'Download URL', 'type':'char', 'size':200, 'readonly':True}, - 'image': {'string':'Image file', 'type':'image'}, + 'image': {'string':'Image file', 'type':'image', 'help': 'support only .png files'}, 'description': {'string':'Description', 'type':'text', 'readonly':True}, 'version': {'string':'Version', 'type':'char', 'readonly':True}, - 'demourl': {'string':'Demo URL', 'type':'char', 'size':128}, - 'docurl': {'string':'Documentation URL', 'type':'char', 'size':128}, + 'demourl': {'string':'Demo URL', 'type':'char', 'size':128, + 'help': 'empty to keep existing value'}, + 'docurl': {'string':'Documentation URL', 'type':'char', 'size':128, + 'help': 'Empty to keep existing value'}, 'category': {'string':'Category', 'type':'selection', 'size':64, 'required':True, - 'selection': _get_selection - }, - 'licence': { + 'selection': _get_selection}, + 'license': { 'string':'Licence', 'type':'selection', 'size':64, 'required':True, - 'selection': [('GPL', 'GPL'), ('Other proprietary','Other proprietary')], - 'default': lambda *args: 'GPL' + 'selection': [('GPL-2', 'GPL-2'), ('Other proprietary','Other proprietary')], + 'default': lambda *args: 'GPL-2' }, + 'include_src': {'string': 'Include source', 'type': 'boolean', + 'default': lambda *a: True}, 'operation': { 'string':'Operation', 'type':'selection', 'readonly':True, 'selection':[('0','Creation'),('1','Modification')], }, - 'url_download': {'string':'Download URL', 'type':'char', 'size':128}, + 'url_download': {'string':'Download URL', 'type':'char', 'size':128, + 'help': 'Keep empty for an auto upload of the module'}, } upload_info_form = '''<?xml version="1.0"?> <form string="Module publication"> <separator string="User information" colspan="4"/> - <label align="0.0" string="Please provide here your login on the Tiny ERP website." colspan="4"/> - <label align="0.0" string="If you don't have an access, you can create one http://tinyerp.com." colspan="4"/> + <label string="Please provide here your login on the Tiny ERP website." + align="0.0" colspan="4"/> + <label string="If you don't have an access, you can create one http://www.tinyerp.com/" + align="0.0" colspan="4"/> <field name="login"/> <field name="password"/> <newline/> @@ -144,22 +155,25 @@ def _get_edit(self, cr, uid, datas, *args): upload_info_fields = { 'login': {'string':'Login', 'type':'char', 'size':32, 'required':True}, 'email': {'string':'Email', 'type':'char', 'size':100, 'required':True}, - 'password': {'string':'Password', 'type':'char', 'size':32, 'required':True, 'invisible':True}, + 'password': {'string':'Password', 'type':'char', 'size':32, 'required':True, + 'invisible':True}, } end_form = '''<?xml version="1.0"?> <form string="Module publication"> <notebook> - <page string="Information"> - <field name="text_end" colspan="4" nolabel="1"/> - </page><page string="Result"> - <field name="result" colspan="4" nolabel="1"/> - </page> + <page string="Information"> + <field name="text_end" colspan="4" nolabel="1"/> + </page> + <page string="Result"> + <field name="result" colspan="4" nolabel="1"/> + </page> </notebook> </form>''' end_fields = { - 'text_end': {'string':'Summary', 'type':'text', 'readonly':True, 'default': lambda *args: """ + 'text_end': {'string':'Summary', 'type':'text', 'readonly':True, + 'default': lambda *args: """ Thank you for contributing ! Your module has been successfully uploaded to the official website. @@ -183,7 +197,8 @@ def post_multipart(host, selector, fields, files): L.append(value) for (key,fname,value) in files: L.append('--' + BOUNDARY) - L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, fname)) + L.append('Content-Disposition: form-data; name="%s"; filename="%s"' + % (key, fname)) L.append('Content-Type: application/octet-stream') L.append('') L.append(value) @@ -210,11 +225,10 @@ def _upload(self, cr, uid, datas, context): mod = pool.get('ir.module.module').browse(cr, uid, datas['id']) download = datas['form']['url_download'] or '' if not download: - res = module_zip.createzip(cr, uid, datas['id'], context, b64enc=False) - - download = 'http://tinyerp.com/download/modules/'+res['module_filename'] - - result = post_multipart('www.tinyerp.com', '/mtree_upload.php', + res = module_zip.createzip(cr, uid, datas['id'], context, + b64enc=False, src=datas['form']['include_src']) + download = 'http://www.tinyerp.com/download/modules/'+res['module_filename'] + result = post_multipart('www.tinyerp.com', '/mtree_upload.php', [ ('login',datas['form']['login']), ('password',datas['form']['password']), @@ -223,8 +237,6 @@ def _upload(self, cr, uid, datas, context): ('module', res['module_filename'], res['module_file']) ]) - # module_file & module_filename - updata = { 'link_name': mod.shortdesc or '', 'new_cat_id': datas['form']['category'], @@ -236,7 +248,7 @@ def _upload(self, cr, uid, datas, context): 'cust_2': datas['form']['demourl'] or '', # Put here the download url 'cust_3': mod.url or '/', 'cust_4': datas['form']['docurl'] or '', - 'cust_5': datas['form']['licence'] or '', + 'cust_5': datas['form']['license'] or '', 'cust_6': mod.latest_version or '', 'cust_7': mod.name, 'option': 'com_mtree', @@ -256,7 +268,8 @@ def _upload(self, cr, uid, datas, context): files = [] if datas['form']['image']: - files.append(('link_image', 'link_image.png', base64.decodestring(datas['form']['image']))) + files.append(('link_image', 'link_image.png', + base64.decodestring(datas['form']['image']))) result = post_multipart('www.tinyerp.com', '/index.php', updata.items(), files) return {'result': result} @@ -276,11 +289,11 @@ def module_check(self, cr, uid, data, context): class base_module_publish(wizard.interface): states = { 'init': { - 'actions': [], + 'actions': [], 'result': { - 'type':'form', + 'type':'form', 'arch':intro_form, - 'fields':intro_fields, + 'fields':intro_fields, 'state':[ ('end','Cancel'), ('step1','Continue') @@ -288,11 +301,11 @@ class base_module_publish(wizard.interface): } }, 'step1': { - 'actions': [module_check,_get_edit], + 'actions': [module_check, _get_edit], 'result': { - 'type':'form', + 'type':'form', 'arch':check_form, - 'fields':check_fields, + 'fields':check_fields, 'state':[ ('end','Cancel'), ('init', 'Previous'), @@ -303,9 +316,9 @@ class base_module_publish(wizard.interface): 'step2': { 'actions': [], 'result': { - 'type':'form', + 'type':'form', 'arch':upload_info_form, - 'fields':upload_info_fields, + 'fields':upload_info_fields, 'state':[ ('end','Cancel'), ('step1', 'Previous'), @@ -316,9 +329,9 @@ class base_module_publish(wizard.interface): 'publish': { 'actions': [_upload], # Action to develop: upload method 'result': { - 'type':'form', + 'type':'form', 'arch':end_form, - 'fields':end_fields, + 'fields':end_fields, 'state':[ ('end','Close') ] |
