From 242c0094d9777396e5ca0e7438e3e7d75a20b09c Mon Sep 17 00:00:00 2001 From: Rifakat Date: Wed, 6 Feb 2013 12:52:26 +0530 Subject: [PATCH 01/11] [FIX] l10n_be_coda: bank statement line has wrong domain concerning parent which is error prone as its a list view which does not have parent view bzr revid: rha@tinyerp.com-20130206072226-q08kv4h2txrgr1tb --- addons/l10n_be_coda/l10n_be_coda_view.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be_coda/l10n_be_coda_view.xml b/addons/l10n_be_coda/l10n_be_coda_view.xml index 2464e5e9082..07af80b5660 100644 --- a/addons/l10n_be_coda/l10n_be_coda_view.xml +++ b/addons/l10n_be_coda/l10n_be_coda_view.xml @@ -44,11 +44,12 @@ + - - + + From cdb96761d4ab0a8b01b6f22e445fff00ba1ce189 Mon Sep 17 00:00:00 2001 From: Hardik Ansodariya Date: Tue, 12 Feb 2013 17:01:33 +0530 Subject: [PATCH 02/11] [FIX] hr_holidays: add date_from field in list view in order to be able group by start date(Maintenance case:585171) bzr revid: han@tinyerp.com-20130212113133-0xs34511nn45uqx0 --- addons/hr_holidays/hr_holidays_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index f8b4ad07b77..adee1e71f5d 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -146,6 +146,7 @@ + From 0b637725be2472d68f3a1fa17833a3472fc40431 Mon Sep 17 00:00:00 2001 From: "Ravi Gohil (OpenERP)" Date: Fri, 15 Feb 2013 14:12:13 +0530 Subject: [PATCH 03/11] [FIX] report_webkit: If a certain translateable term happens to be the same src value as on another report (both webkit and non-webkit reports) the resulting translation on a webkit report uses the first translation found (which is highly likely to be from the other report). (Maintenance Case: 586086) lp bug: https://launchpad.net/bugs/1098602 fixed bzr revid: rgo@tinyerp.com-20130215084213-h38jfi447y4qpf94 --- addons/report_webkit/webkit_report.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py index b6c273f8852..6ad950d8302 100644 --- a/addons/report_webkit/webkit_report.py +++ b/addons/report_webkit/webkit_report.py @@ -191,8 +191,9 @@ class WebKitParser(report_sxw): def translate_call(self, src): """Translate String.""" ir_translation = self.pool.get('ir.translation') + name = self.tmpl and 'addons/' + self.tmpl or None res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid, - None, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src) + name, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src) if not res : return src return res From eb6ba5ba47f228adc746cedfa3cd92c154fce60b Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Fri, 15 Feb 2013 15:28:01 +0530 Subject: [PATCH 04/11] [IMP]account:field supplier invoice number should be set in journal entry as description bzr revid: pna@tinyerp.com-20130215095801-wstbzqniydainl4s --- addons/account/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index f255b6788ee..4f49ecec87a 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -926,7 +926,7 @@ class account_invoice(osv.osv): total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml, context=ctx) acc_id = inv.account_id.id - name = inv['name'] or '/' + name = inv['name'] or inv['supplier_invoice_number'] or '/' totlines = False if inv.payment_term: totlines = payment_term_obj.compute(cr, From 98804fea76c5b8393a7bb744e49db3064f0c8a86 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Mon, 10 Jun 2013 17:54:39 +0200 Subject: [PATCH 05/11] [FIX] project - do not copy task_ids of res.partner lp bug: https://launchpad.net/bugs/1189524 fixed bzr revid: yannick.vaucher@camptocamp.com-20130610155439-azna00gbw1z56y34 --- addons/project/res_partner.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/project/res_partner.py b/addons/project/res_partner.py index 97fca8c459f..fe8561b6059 100644 --- a/addons/project/res_partner.py +++ b/addons/project/res_partner.py @@ -29,6 +29,13 @@ class res_partner(osv.osv): 'task_ids': fields.one2many('project.task', 'partner_id', 'Tasks'), } + def copy(self, cr, uid, record_id, default=None, context=None): + if default is None: + default = {} + + default.update({'task_ids': []}) + return super(res_partner, self).copy(cr, uid, record_id, default, context) + res_partner() From 0f00714c10b116f7a4b6c2ffb8d2729b3f751f53 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Tue, 11 Jun 2013 09:58:06 +0200 Subject: [PATCH 06/11] [IMP] project - adding missing argument names bzr revid: yannick.vaucher@camptocamp.com-20130611075806-fgr8xkz6zbetgrkm --- addons/project/res_partner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/project/res_partner.py b/addons/project/res_partner.py index fe8561b6059..592f640211e 100644 --- a/addons/project/res_partner.py +++ b/addons/project/res_partner.py @@ -34,7 +34,8 @@ class res_partner(osv.osv): default = {} default.update({'task_ids': []}) - return super(res_partner, self).copy(cr, uid, record_id, default, context) + return super(res_partner, self).copy( + cr, uid, record_id, default=default, context=context) res_partner() From be80d2ec944da4aa40c14696fb0b37834e9994fd Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of openerp <> Date: Wed, 12 Jun 2013 05:57:31 +0000 Subject: [PATCH 07/11] Launchpad automatic translations update. bzr revid: launchpad_translations_on_behalf_of_openerp-20130612055731-f24di0etqrugwqfp --- addons/mail/i18n/it.po | 95 ++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 37 deletions(-) diff --git a/addons/mail/i18n/it.po b/addons/mail/i18n/it.po index 6a059d3770a..027b3d55da6 100644 --- a/addons/mail/i18n/it.po +++ b/addons/mail/i18n/it.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2013-06-07 19:36+0000\n" -"PO-Revision-Date: 2013-03-05 11:02+0000\n" -"Last-Translator: Davide Corio \n" +"PO-Revision-Date: 2013-06-11 10:00+0000\n" +"Last-Translator: electro \n" "Language-Team: Italian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-06-08 07:28+0000\n" +"X-Launchpad-Export-Date: 2013-06-12 05:57+0000\n" "X-Generator: Launchpad (build 16667)\n" #. module: mail @@ -26,7 +26,7 @@ msgstr "Modulo Followers" #: code:addons/mail/mail_thread.py:246 #, python-format msgid "%s created" -msgstr "" +msgstr "%s creato" #. module: mail #: field:mail.compose.message,author_id:0 @@ -113,7 +113,7 @@ msgstr "Pubblica" #: code:addons/mail/static/src/xml/mail.xml:277 #, python-format msgid "to" -msgstr "" +msgstr "a" #. module: mail #: view:mail.mail:0 @@ -145,7 +145,7 @@ msgstr "Wizard composizione email" #: code:addons/mail/static/src/xml/mail.xml:268 #, python-format msgid "updated document" -msgstr "" +msgstr "documento aggiornato" #. module: mail #. openerp-web @@ -169,6 +169,15 @@ msgid "" "discussions\n" "- All Messages: for every notification you receive in your Inbox" msgstr "" +"Opzioni per ricevere anche alla propria email i messaggi ricevuti nella tua " +"inbox personale:\n" +"- Mai: nessuna email viene inviata\n" +"- Solo email in arrivo: ricevi i messaggi ricevuti via posta elettronica " +"dal sistema \n" +"- Email in arrivo e discussioni: ricevi i messaggi sia per le discussioni " +"interne che per quelli ricevuti via posta elettronica dal sistema\n" +"- Tutti i messaggi: ricevi tutti i messaggi che ricevi nella tua inbos " +"personale" #. module: mail #: field:mail.group,message_unread:0 @@ -221,6 +230,9 @@ msgid "" " %s won't be notified of any email or discussion on this document. Do you " "really want to remove him from the followers ?" msgstr "" +"Attenzione! \n" +" %s non verrà più notficato per alcuna email o discussione relativa a questo " +"documento. Vuoi realmente rimuoverlo dai followers ?" #. module: mail #: field:mail.compose.message,res_id:0 @@ -283,7 +295,7 @@ msgstr "Ricevuti" #: code:addons/mail/static/src/xml/mail.xml:71 #, python-format msgid "Attach a File" -msgstr "" +msgstr "Allega un file" #. module: mail #: view:mail.mail:0 @@ -391,7 +403,7 @@ msgstr "
Sei stato invitato a seguire %s.
" #: code:addons/mail/static/src/xml/mail.xml:53 #, python-format msgid "Send a message" -msgstr "" +msgstr "Invia un messaggio" #. module: mail #: help:mail.group,message_unread:0 @@ -426,14 +438,14 @@ msgstr "Eliminazione Automatica" #: code:addons/mail/static/src/xml/mail.xml:294 #, python-format msgid "notified" -msgstr "" +msgstr "notificato" #. module: mail #. openerp-web #: code:addons/mail/static/src/xml/mail.xml:274 #, python-format msgid "logged a note" -msgstr "" +msgstr "registrato una nota" #. module: mail #. openerp-web @@ -503,7 +515,7 @@ msgstr "" #. module: mail #: view:base.config.settings:0 msgid "mycompany.my.openerp.com" -msgstr "" +msgstr "miaazienda.my.openerp.com" #. module: mail #: field:mail.message.subtype,relation_field:0 @@ -519,7 +531,7 @@ msgstr "Notifica di sistema" #. module: mail #: view:mail.message:0 msgid "To Read" -msgstr "" +msgstr "Da leggere" #. module: mail #: model:ir.model,name:mail.model_res_partner @@ -583,7 +595,7 @@ msgstr "followers" #. module: mail #: view:mail.group:0 msgid "Send a message to the group" -msgstr "" +msgstr "Invia un messaggio al gruppo" #. module: mail #. openerp-web @@ -632,7 +644,7 @@ msgstr "Archivi" #. module: mail #: view:mail.compose.message:0 msgid "Subject..." -msgstr "" +msgstr "Oggetto..." #. module: mail #. openerp-web @@ -741,7 +753,7 @@ msgstr "Mittente messaggi, preso dalle preferenze utente." #: code:addons/mail/static/src/js/mail.js:978 #, python-format msgid "read more" -msgstr "" +msgstr "leggi tutto" #. module: mail #: code:addons/mail/wizard/invite.py:40 @@ -759,6 +771,7 @@ msgstr "Messaggio Superiore" #: selection:res.partner,notification_email_send:0 msgid "All Messages (discussions, emails, followed system notifications)" msgstr "" +"Tutti i messaggi (discussioni, email, notifiche di sistema ai follower)" #. module: mail #. openerp-web @@ -769,6 +782,9 @@ msgid "" "You won't be notified of any email or discussion on this document. Do you " "really want to unfollow this document ?" msgstr "" +"Attenzione! \n" +"Non sarai più notificato per alcuna email o discussione relativa a questo " +"documento. Vuoi realmente smettere di seguire questo documento ?" #. module: mail #: model:ir.actions.client,help:mail.action_mail_to_me_feeds @@ -842,7 +858,7 @@ msgstr "Model della risorsa seguita" #: code:addons/mail/static/src/js/mail.js:979 #, python-format msgid "read less" -msgstr "" +msgstr "leggi meno" #. module: mail #. openerp-web @@ -922,7 +938,7 @@ msgstr "Sottotipi di Messaggio" #: code:addons/mail/static/src/xml/mail.xml:55 #, python-format msgid "Log a note" -msgstr "" +msgstr "Registra una nota" #. module: mail #: selection:mail.compose.message,type:0 @@ -1035,7 +1051,7 @@ msgstr "Proprietario" #: code:addons/mail/res_partner.py:52 #, python-format msgid "Partner Profile" -msgstr "" +msgstr "Profilo del Partner" #. module: mail #: model:ir.model,name:mail.model_mail_message @@ -1070,6 +1086,8 @@ msgid "" "Description that will be added in the message posted for this subtype. If " "void, the name will be added instead." msgstr "" +"Descrizione che verrà aggiunta al messaggio inviato per questo sottotipo. Se " +"è vuota, sarà aggiunto il nome." #. module: mail #: field:mail.compose.message,vote_user_ids:0 @@ -1110,11 +1128,12 @@ msgstr "Prego completare le informazioni sul Patner" #, python-format msgid "

Access this document directly in OpenERP

" msgstr "" +"

Accedi a questo documento direttamente in OpenERP

" #. module: mail #: view:mail.compose.message:0 msgid "Followers of selected items and" -msgstr "" +msgstr "Followers degli element selezionati e" #. module: mail #: field:mail.alias,alias_force_thread_id:0 @@ -1180,7 +1199,7 @@ msgstr "o" #: code:addons/mail/mail_thread.py:111 #, python-format msgid "You have one unread message" -msgstr "" +msgstr "Hai un messaggio non letto" #. module: mail #: help:mail.compose.message,record_name:0 @@ -1240,7 +1259,7 @@ msgstr "" #. module: mail #: field:res.partner,notification_email_send:0 msgid "Receive Messages by Email" -msgstr "" +msgstr "Ricevi i messaggi per email" #. module: mail #: model:mail.group,name:mail.group_best_sales_practices @@ -1289,14 +1308,14 @@ msgstr "Filtri Estesi..." #. module: mail #: selection:res.partner,notification_email_send:0 msgid "Incoming Emails only" -msgstr "" +msgstr "Solo email in arrivo" #. module: mail #. openerp-web #: code:addons/mail/static/src/xml/mail.xml:292 #, python-format msgid "more" -msgstr "" +msgstr "di più" #. module: mail #. openerp-web @@ -1351,13 +1370,13 @@ msgstr "Riepilogo" #: code:addons/mail/mail_mail.py:244 #, python-format msgid "\"Followers of %s\" <%s>" -msgstr "" +msgstr "\"Followers di %s\" <%s>" #. module: mail #: view:mail.compose.message:0 #: view:mail.wizard.invite:0 msgid "Add contacts to notify..." -msgstr "" +msgstr "Aggiungi un contatto da notificare..." #. module: mail #: view:mail.group:0 @@ -1369,7 +1388,7 @@ msgstr "Form Gruppo" #: field:mail.message,starred:0 #: field:mail.notification,starred:0 msgid "Starred" -msgstr "" +msgstr "Votato" #. module: mail #: field:mail.group,menu_id:0 @@ -1415,13 +1434,13 @@ msgstr "" #: code:addons/mail/static/src/xml/mail_followers.xml:52 #, python-format msgid "And" -msgstr "" +msgstr "E" #. module: mail #: code:addons/mail/mail_thread.py:111 #, python-format msgid "You have %d unread messages" -msgstr "" +msgstr "Ci sono %d nuovi messaggi" #. module: mail #: field:mail.compose.message,message_id:0 @@ -1464,7 +1483,7 @@ msgstr "" #. module: mail #: view:mail.group:0 msgid "Topics discussed in this group..." -msgstr "" +msgstr "Argomenti disccussi in questo gruppo..." #. module: mail #. openerp-web @@ -1541,7 +1560,7 @@ msgstr "" #. module: mail #: view:mail.message:0 msgid "Show already read messages" -msgstr "" +msgstr "Mostra messaggi già letti" #. module: mail #: view:mail.message:0 @@ -1620,7 +1639,7 @@ msgstr "Rimuovi questo follower" #. module: mail #: selection:res.partner,notification_email_send:0 msgid "Never" -msgstr "Più recente" +msgstr "Mai" #. module: mail #: field:mail.mail,mail_server_id:0 @@ -1705,29 +1724,29 @@ msgstr "Ripristina a Da Fare" #: code:addons/mail/static/src/xml/mail.xml:154 #, python-format msgid "Attach a note that will not be sent to the followers" -msgstr "" +msgstr "Allega una nota che sarà inviata ai followers" #. module: mail #. openerp-web #: code:addons/mail/static/src/xml/mail.xml:279 #, python-format msgid "nobody" -msgstr "" +msgstr "nessuno" #. module: mail #: selection:res.partner,notification_email_send:0 msgid "Incoming Emails and Discussions" -msgstr "" +msgstr "Email in arrivo e discussioni" #. module: mail #: field:mail.group,name:0 msgid "Name" -msgstr "" +msgstr "Nome" #. module: mail #: constraint:res.partner:0 msgid "You cannot create recursive Partner hierarchies." -msgstr "" +msgstr "Non puoi creare gerarchie ricorsive per i Partner" #. module: mail #: help:base.config.settings,alias_domain:0 @@ -1789,7 +1808,7 @@ msgstr "" #: code:addons/mail/static/src/xml/mail.xml:149 #, python-format msgid "(no email address)" -msgstr "" +msgstr "(nessun indirizzo email)" #. module: mail #: model:ir.ui.menu,name:mail.mail_feeds @@ -1841,6 +1860,8 @@ msgstr "Modo composizione" msgid "" "Model the subtype applies to. If False, this subtype applies to all models." msgstr "" +"Modello a cui applicare il sottotipo. Se False, questo sottotipo è applicato " +"a tutti i modelli." #. module: mail #. openerp-web From e532701d28d63fba37df3149e89804630f14f999 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 12 Jun 2013 11:25:49 +0200 Subject: [PATCH 08/11] [IMP] portal_hr_employee: remove create button on kanban view bzr revid: mat@openerp.com-20130612092549-15auuwcf271kpcle --- addons/portal_hr_employees/hr_employee_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/portal_hr_employees/hr_employee_view.xml b/addons/portal_hr_employees/hr_employee_view.xml index eca13258ff9..7b038747c60 100644 --- a/addons/portal_hr_employees/hr_employee_view.xml +++ b/addons/portal_hr_employees/hr_employee_view.xml @@ -37,7 +37,7 @@ hr.employee - + From 8722e2a01e29c36848a8bba84ae6ed71ccb97abc Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 12 Jun 2013 11:53:00 +0200 Subject: [PATCH 09/11] [FIX] res.partner: name_search() should match complete contact names in the format returned by name_get() This was missed during the change of the name_get() format at revision 4923.1.12 revid:odo@openerp.com-20130416093121-t5soophs2aui8rzq lp bug: https://launchpad.net/bugs/1188300 fixed bzr revid: odo@openerp.com-20130612095300-pcr3ly5g7bv656i1 --- openerp/addons/base/res/res_partner.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index 0c9c1f5ed45..92414e764f3 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -593,10 +593,16 @@ class res_partner(osv.osv, format_address): if limit: limit_str = ' limit %(limit)s' query_args['limit'] = limit + # TODO: simplify this in trunk with _rec_name='display_name', once display_name + # becomes a stored field cr.execute('''SELECT partner.id FROM res_partner partner LEFT JOIN res_partner company ON partner.parent_id = company.id - WHERE partner.email ''' + operator +''' %(name)s - OR partner.name || ' (' || COALESCE(company.name,'') || ')' + WHERE partner.email ''' + operator +''' %(name)s OR + CASE WHEN company.id IS NULL OR partner.is_company + THEN partner.name + ELSE + company.name || ', ' || partner.name + END ''' + operator + ' %(name)s ' + limit_str, query_args) ids = map(lambda x: x[0], cr.fetchall()) ids = self.search(cr, uid, [('id', 'in', ids)] + args, limit=limit, context=context) From 4d262c48c4c3f74c0ce1b2654b316ad52dd04839 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Wed, 12 Jun 2013 13:36:48 +0200 Subject: [PATCH 10/11] [IMP] remove useless use of update dict bzr revid: yannick.vaucher@camptocamp.com-20130612113648-8lbirmp38q5uyolv --- addons/project/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/res_partner.py b/addons/project/res_partner.py index 592f640211e..4c4687b96da 100644 --- a/addons/project/res_partner.py +++ b/addons/project/res_partner.py @@ -33,7 +33,7 @@ class res_partner(osv.osv): if default is None: default = {} - default.update({'task_ids': []}) + default['task_ids'] = [] return super(res_partner, self).copy( cr, uid, record_id, default=default, context=context) From e383386a79a2c574da8ab8b3d32a43b050fcdc78 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 12 Jun 2013 17:19:12 +0200 Subject: [PATCH 11/11] [FIX] correct stripping of arguments when _reexec() OpenERP bzr revid: chs@openerp.com-20130612151912-m19okjsdkjo12qnt --- openerp/service/__init__.py | 7 +++---- openerp/tools/misc.py | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/openerp/service/__init__.py b/openerp/service/__init__.py index c95e35d8252..b26213dd5be 100644 --- a/openerp/service/__init__.py +++ b/openerp/service/__init__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). -# Copyright (C) 2010-2012 OpenERP SA () +# Copyright (C) 2010-2013 OpenERP SA () # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -39,6 +39,7 @@ import openerp.netsvc import openerp.osv from openerp.release import nt_service_name import openerp.tools +from openerp.tools.misc import stripped_sys_argv #.apidoc title: RPC Services @@ -132,9 +133,7 @@ def _reexec(): if openerp.tools.osutil.is_running_as_nt_service(): subprocess.call('net stop {0} && net start {0}'.format(nt_service_name), shell=True) exe = os.path.basename(sys.executable) - strip_args = ['-d', '-u'] - a = sys.argv[:] - args = [x for i, x in enumerate(a) if x not in strip_args and a[max(i - 1, 0)] not in strip_args] + args = stripped_sys_argv() if not args or args[0] != exe: args.insert(0, exe) os.execv(sys.executable, args) diff --git a/openerp/tools/misc.py b/openerp/tools/misc.py index fc940681d3b..68fbe51ed9c 100644 --- a/openerp/tools/misc.py +++ b/openerp/tools/misc.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). -# Copyright (C) 2010-2012 OpenERP s.a. (). +# Copyright (C) 2010-2013 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -38,7 +38,7 @@ import time import zipfile from collections import defaultdict from datetime import datetime -from itertools import islice, izip +from itertools import islice, izip, groupby from lxml import etree from which import which from threading import local @@ -1075,4 +1075,22 @@ class CountingStream(object): raise StopIteration() return val +def stripped_sys_argv(*strip_args): + """Return sys.argv with some arguments stripped, suitable for reexecution or subprocesses""" + strip_args = sorted(set(strip_args) | set(['-s', '--save', '-d', '--database', '-u', '--update', '-i', '--init'])) + assert all(config.parser.has_option(s) for s in strip_args) + takes_value = dict((s, config.parser.get_option(s).takes_value()) for s in strip_args) + + longs, shorts = list(tuple(y) for _, y in groupby(strip_args, lambda x: x.startswith('--'))) + longs_eq = tuple(l + '=' for l in longs if takes_value[l]) + + args = sys.argv[:] + + def strip(args, i): + return args[i].startswith(shorts) \ + or args[i].startswith(longs_eq) or (args[i] in longs) \ + or (i >= 1 and (args[i - 1] in strip_args) and takes_value[args[i - 1]]) + + return [x for i, x in enumerate(args) if not strip(args, i)] + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: