From 22e5e30532bfc08dadf0dc7178a543978f2f36d6 Mon Sep 17 00:00:00 2001 From: ced <> Date: Mon, 30 Jul 2007 13:35:27 +0000 Subject: [PATCH] base,kernel,base_module_publish: improve publication of module, add repository, etc... - add repository for module - improve version number - add check to remove module - can not upload module with the same version number - add version compare from portage (gentoo) - add release in context of eval - add active = True to base module - add wizard to update all installed modules - add check to not upload module that is not installed - add posibility to include source - fix license - now load zip module in preference bzr revid: ced-cd441fca164f32bf2a1243a4ebf8c6afdf240cdf --- addons/base_module_publish/__terp__.py | 1 - .../base_module_publish_wizard.xml | 12 +- .../scripts/mtree_upload.php | 24 ++- addons/base_module_publish/wizard/__init__.py | 1 + .../wizard/base_module_publish.py | 17 +- .../wizard/base_module_publish_all.py | 181 ++++++++++++++++++ .../base_module_publish/wizard/module_zip.py | 8 +- 7 files changed, 223 insertions(+), 21 deletions(-) create mode 100644 addons/base_module_publish/wizard/base_module_publish_all.py diff --git a/addons/base_module_publish/__terp__.py b/addons/base_module_publish/__terp__.py index 632c09dcfad..bd1581c6004 100644 --- a/addons/base_module_publish/__terp__.py +++ b/addons/base_module_publish/__terp__.py @@ -19,6 +19,5 @@ to call this button when you want to release a new version of your module. "init_xml" : [ ], "demo_xml" : [ ], "update_xml" : [ "base_module_publish_wizard.xml" ], - "active": True, "installable": True } diff --git a/addons/base_module_publish/base_module_publish_wizard.xml b/addons/base_module_publish/base_module_publish_wizard.xml index 6dc2238aa41..7d53dab6120 100644 --- a/addons/base_module_publish/base_module_publish_wizard.xml +++ b/addons/base_module_publish/base_module_publish_wizard.xml @@ -1,12 +1,20 @@ - + + diff --git a/addons/base_module_publish/wizard/__init__.py b/addons/base_module_publish/wizard/__init__.py index a7900b66df3..891571d9a64 100644 --- a/addons/base_module_publish/wizard/__init__.py +++ b/addons/base_module_publish/wizard/__init__.py @@ -27,4 +27,5 @@ ############################################################################## import base_module_publish +import base_module_publish_all import wizard_module_export diff --git a/addons/base_module_publish/wizard/base_module_publish.py b/addons/base_module_publish/wizard/base_module_publish.py index d7f5fbcf329..353c794083a 100644 --- a/addons/base_module_publish/wizard/base_module_publish.py +++ b/addons/base_module_publish/wizard/base_module_publish.py @@ -51,7 +51,7 @@ Make sure you read the publication manual and modules guidelines before continuing: http://www.tinyerp.com -Thank you for contributing ! +Thank you for contributing! """}, } @@ -237,6 +237,13 @@ def _upload(self, cr, uid, datas, context): ], [ ('module', res['module_filename'], res['module_file']) ]) + if result[0] == "1": + raise wizard.except_wizard('Error', 'Login failed!') + elif result[0] == "2": + raise wizard.except_wizard('Error', + 'This version of the module is already exist on the server') + elif result[0] != "0": + raise wizard.except_wizard('Error', 'Failed to upload the file') updata = { 'link_name': mod.shortdesc or '', @@ -250,7 +257,7 @@ def _upload(self, cr, uid, datas, context): 'cust_3': mod.url or '/', 'cust_4': datas['form']['docurl'] or '', 'cust_5': datas['form']['license'] or '', - 'cust_6': mod.latest_version or '', + 'cust_6': mod.installed_version or '0', 'cust_7': mod.name, 'option': 'com_mtree', 'task': 'savelisting', @@ -277,6 +284,8 @@ def _upload(self, cr, uid, datas, context): def module_check(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) module = pool.get('ir.module.module').browse(cr, uid, data['id'], context) + if module.state != 'installed': + raise wizard.except_wizard('Error', 'You could not publish a module that is not installed!') return { 'name': module.name, 'shortdesc': module.shortdesc, @@ -284,7 +293,7 @@ def module_check(self, cr, uid, data, context): 'website': module.website, 'url': module.url, 'description': module.description, - 'version': module.latest_version, + 'version': module.installed_version, 'license': module.license, } @@ -324,7 +333,7 @@ class base_module_publish(wizard.interface): 'state':[ ('end','Cancel'), ('step1', 'Previous'), - ('publish','Publish Now !') + ('publish','Publish') ] } }, diff --git a/addons/base_module_publish/wizard/base_module_publish_all.py b/addons/base_module_publish/wizard/base_module_publish_all.py new file mode 100644 index 00000000000..1cd84d25690 --- /dev/null +++ b/addons/base_module_publish/wizard/base_module_publish_all.py @@ -0,0 +1,181 @@ +############################################################################## +# +# Copyright (c) 2005-2007 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard +import pooler +import module_zip +from base_module_publish import post_multipart +from urllib import urlopen + +intro_form = ''' +
+ + +''' + +intro_fields = { + 'text': {'string': 'Introduction', 'type': 'text', 'readonly': True, + 'default': lambda *a: """ +This system will automatically publish and upload the selected modules to the +Tiny ERP official website. You can use it to quickly update a set of +module (new version). + +Make sure you read the publication manual and modules guidlines +before continuing: + http://www.tinyerp.com/ + +Thanks you for contributing! +"""}, +} + +login_form = ''' +
+ +