diff --git a/currency_rate_update/__init__.py b/currency_rate_update/__init__.py old mode 100755 new mode 100644 index f5d0d7942..78d977935 --- a/currency_rate_update/__init__.py +++ b/currency_rate_update/__init__.py @@ -1,30 +1,22 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2008 Camtocamp SA -# @author JB Aubort, Nicolas Bessi, Joel Grand-Guillaume -# European Central Bank and Polish National Bank invented by Grzegorz Grzelak -# $Id: $ +# Copyright (c) 2008 Camtocamp SA +# @author JB Aubort, Nicolas Bessi, Joel Grand-Guillaume +# European Central Bank and Polish National Bank invented by Grzegorz Grzelak # -# 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 Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. # -# 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 Affero General Public License for more details. # -# 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. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . # ############################################################################## diff --git a/currency_rate_update/__openerp__.py b/currency_rate_update/__openerp__.py old mode 100755 new mode 100644 index db4db3ae3..ed0518729 --- a/currency_rate_update/__openerp__.py +++ b/currency_rate_update/__openerp__.py @@ -1,30 +1,23 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2008 Camtocamp SA -# @author JB Aubort, Nicolas Bessi, Joel Grand-Guillaume -# European Central Bank and Polish National Bank invented by Grzegorz Grzelak -# Ported to OpenERP 7.0 by Lorenzo Battistini +# Copyright (c) 2008 Camtocamp SA +# @author JB Aubort, Nicolas Bessi, Joel Grand-Guillaume +# European Central Bank and Polish National Bank invented by Grzegorz Grzelak +# Ported to OpenERP 7.0 by Lorenzo Battistini # -# 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 Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. # -# 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 Affero General Public License for more details. # -# 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. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . # ############################################################################## { diff --git a/currency_rate_update/company.py b/currency_rate_update/company.py index 6696aa57b..344e65396 100644 --- a/currency_rate_update/company.py +++ b/currency_rate_update/company.py @@ -1,30 +1,21 @@ # -*- coding: utf-8 -*- -# company.py -# c2c_currency_update -# @author Nicolas Bessi -# Copyright (c) 2009 CamptoCamp. 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 +# Copyright (c) 2009 CamptoCamp. All rights reserved. +# @author Nicolas Bessi # -# 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 free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 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. +# 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 Affero 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. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . # ############################################################################## @@ -33,7 +24,7 @@ from openerp.osv import fields, osv class res_company(osv.Model): """override company to add currency update""" - + def _multi_curr_enable(self, cr, uid, ids, field_name, arg, context={}): "check if multi company currency is enabled" result = {} @@ -44,8 +35,8 @@ class res_company(osv.Model): for id in ids: result[id] = enable return result - - + + def button_refresh_currency(self, cr, uid, ids, context=None): """Refrech the currency !!for all the company now""" @@ -55,18 +46,18 @@ class res_company(osv.Model): except Exception, e: return False return True - - + + def on_change_auto_currency_up(self, cr, uid, id, value): """handle the activation of the currecny update on compagnies. - There are two ways of implementing multi_company currency, + There are two ways of implementing multi_company currency, the currency is shared or not. The module take care of the two - ways. If the currency are shared, you will only be able to set - auto update on one company, this will avoid to have unusefull cron - object running. + ways. If the currency are shared, you will only be able to set + auto update on one company, this will avoid to have unusefull cron + object running. If yours currency are not share you will be able to activate the auto update on each separated company""" - + if len(id) : id = id[0] else : @@ -78,12 +69,12 @@ class res_company(osv.Model): # this statement is here beacaus we do no want to save in case of error self.write(cr, uid, id,{'auto_currency_up':value}) for comp in compagnies : - if self.browse(cr, uid, comp).auto_currency_up: + if self.browse(cr, uid, comp).auto_currency_up: activate_cron = 't' break self.pool.get('currency.rate.update').save_cron( - cr, - uid, + cr, + uid, {'active':activate_cron} ) return {} @@ -94,10 +85,10 @@ class res_company(osv.Model): #we ensure taht we did not have write a true value self.write(cr, uid, id,{'auto_currency_up':False}) return { - 'value':{ + 'value':{ 'auto_currency_up':False }, - + 'warning':{ 'title':"Warning", 'message': 'Yon can not activate auto currency '+\ @@ -107,44 +98,44 @@ class res_company(osv.Model): } self.write(cr, uid, id,{'auto_currency_up':value}) for comp in compagnies : - if self.browse(cr, uid, comp).auto_currency_up: + if self.browse(cr, uid, comp).auto_currency_up: activate_cron = 't' self.pool.get('currency.rate.update').save_cron( - cr, - uid, + cr, + uid, {'active':activate_cron} ) break return {} - - + + def on_change_intervall(self, cr, uid, id, interval) : ###Function that will update the cron ###freqeuence self.pool.get('currency.rate.update').save_cron( - cr, - uid, + cr, + uid, {'interval_type':interval} ) compagnies = self.search(cr, uid, []) for comp in compagnies : self.write(cr, uid, comp,{'interval_type':interval}) return {} - + _inherit = "res.company" _columns = { ### activate the currency update 'auto_currency_up': fields.boolean('Automatical update of the currency this company'), 'services_to_use' : fields.one2many( - 'currency.rate.update.service', + 'currency.rate.update.service', 'company_id', - 'Currency update services' + 'Currency update services' ), ###predifine cron frequence 'interval_type': fields.selection( [ - ('days','Day(s)'), - ('weeks', 'Week(s)'), + ('days','Day(s)'), + ('weeks', 'Week(s)'), ('months', 'Month(s)') ], 'Currency update frequence', @@ -152,15 +143,15 @@ class res_company(osv.Model): also affect other compagnies""" ), ###function field that allows to know the - ###mutli company currency implementation + ###mutli company currency implementation 'multi_company_currency_enable' : fields.function( - _multi_curr_enable, - method=True, - type='boolean', + _multi_curr_enable, + method=True, + type='boolean', string="Multi company currency", help='if this case is not check you can'+\ ' not set currency is active on two company' ), - } + } diff --git a/currency_rate_update/company_view.xml b/currency_rate_update/company_view.xml old mode 100755 new mode 100644 index 1e9698da7..1a2c79b5f --- a/currency_rate_update/company_view.xml +++ b/currency_rate_update/company_view.xml @@ -21,4 +21,3 @@ - diff --git a/currency_rate_update/currency_rate_update.py b/currency_rate_update/currency_rate_update.py old mode 100755 new mode 100644 index 99653b969..afa3eb920 --- a/currency_rate_update/currency_rate_update.py +++ b/currency_rate_update/currency_rate_update.py @@ -1,41 +1,33 @@ # -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2009 Camptocamp SA -# @author Nicolas Bessi -# @source JBA and AWST inpiration -# @contributor Grzegorz Grzelak (grzegorz.grzelak@birdglobe.com), Joel Grand-Guillaume -# Copyright (c) 2010 Alexis de Lattre (alexis@via.ecp.fr) -# - ported XML-based webservices (Admin.ch, ECB, PL NBP) to new XML lib -# - rates given by ECB webservice is now correct even when main_cur <> EUR -# - rates given by PL_NBP webservice is now correct even when main_cur <> PLN -# - if company_currency <> CHF, you can now update CHF via Admin.ch webservice -# (same for EUR with ECB webservice and PLN with NBP webservice) -# For more details, see Launchpad bug #645263 -# - mecanism to check if rates given by the webservice are "fresh" enough to be -# written in OpenERP ('max_delta_days' parameter for each currency update service) -# Ported to OpenERP 7.0 by Lorenzo Battistini +# Copyright (c) 2009 Camptocamp SA +# @author Nicolas Bessi +# @source JBA and AWST inpiration +# @contributor Grzegorz Grzelak (grzegorz.grzelak@birdglobe.com), Joel Grand-Guillaume +# Copyright (c) 2010 Alexis de Lattre (alexis@via.ecp.fr) +# - ported XML-based webservices (Admin.ch, ECB, PL NBP) to new XML lib +# - rates given by ECB webservice is now correct even when main_cur <> EUR +# - rates given by PL_NBP webservice is now correct even when main_cur <> PLN +# - if company_currency <> CHF, you can now update CHF via Admin.ch webservice +# (same for EUR with ECB webservice and PLN with NBP webservice) +# For more details, see Launchpad bug #645263 +# - mecanism to check if rates given by the webservice are "fresh" enough to be +# written in OpenERP ('max_delta_days' parameter for each currency update service) +# Ported to OpenERP 7.0 by Lorenzo Battistini # -# 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 Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. # -# 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 Affero General Public License for more details. # -# 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. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . # ############################################################################## @@ -52,17 +44,17 @@ from openerp.tools.translate import _ _logger = logging.getLogger(__name__) class Currency_rate_update_service(osv.Model): - """Class thats tell for wich services wich currencies + """Class thats tell for wich services wich currencies have to be updated""" _name = "currency.rate.update.service" _description = "Currency Rate Update" _columns = { - ##list of webservicies the value sould be a class name - 'service' : fields.selection( + ##list of webservicies the value sould be a class name + 'service' : fields.selection( [ ('Admin_ch_getter','Admin.ch'), ('ECB_getter','European Central Bank'), - #('NYFB_getter','Federal Reserve Bank of NY'), + #('NYFB_getter','Federal Reserve Bank of NY'), #('Google_getter','Google Finance'), ('Yahoo_getter','Yahoo Finance '), ('PL_NBP_getter','Narodowy Bank Polski'), # Added for polish rates @@ -70,7 +62,7 @@ class Currency_rate_update_service(osv.Model): "Webservice to use", required = True ), - ##list of currency to update + ##list of currency to update 'currency_to_update' : fields.many2many( 'res.currency', 'res_curreny_auto_udate_rel', @@ -78,7 +70,7 @@ class Currency_rate_update_service(osv.Model): 'currency_id', 'currency to update with this service', ), - #back ref + #back ref 'company_id' : fields.many2one( 'res.company', 'linked company', @@ -92,8 +84,8 @@ class Currency_rate_update_service(osv.Model): } _sql_constraints = [ ( - 'curr_service_unique', - 'unique (service, company_id)', + 'curr_service_unique', + 'unique (service, company_id)', _('You can use a service one time per company !') ) ] @@ -112,7 +104,7 @@ class Currency_rate_update_service(osv.Model): class Currency_rate_update(osv.Model): - """Class that handle an ir cron call who will + """Class that handle an ir cron call who will update currencies based on a web url""" _name = "currency.rate.update" _description = "Currency Rate Update" @@ -127,47 +119,47 @@ class Currency_rate_update(osv.Model): 'doall' : True, 'model' : 'currency.rate.update', 'function' : 'run_currency_update', - 'args' : '()', + 'args' : '()', } - + LOG_NAME = 'cron-rates' MOD_NAME = 'c2c_currency_rate_update: ' def get_cron_id(self, cr, uid, context): """return the updater cron's id. Create one if the cron does not exists """ - + cron_id = 0 cron_obj = self.pool.get('ir.cron') - try: + try: #find the cron that send messages cron_id = cron_obj.search( - cr, - uid, + cr, + uid, [ - ('function', 'ilike', self.cron['function']), + ('function', 'ilike', self.cron['function']), ('model', 'ilike', self.cron['model']) - ], + ], context={ 'active_test': False - } + } ) cron_id = int(cron_id[0]) except Exception,e : _logger.info('warning cron not found one will be created') pass # ignore if the cron is missing cause we are going to create it in db - + #the cron does not exists if not cron_id : #translate self.cron['name'] = _('Currency Rate Update') cron_id = cron_obj.create(cr, uid, self.cron, context) - + return cron_id - + def save_cron(self, cr, uid, datas, context={}): """save the cron config data should be a dict""" #modify the cron - cron_id = self.get_cron_id(cr, uid, context) - result = self.pool.get('ir.cron').write(cr, uid, [cron_id], datas) + cron_id = self.get_cron_id(cr, uid, context) + result = self.pool.get('ir.cron').write(cr, uid, [cron_id], datas) def run_currency_update(self, cr, uid): "update currency at the given frequence" @@ -176,7 +168,7 @@ class Currency_rate_update(osv.Model): rate_obj = self.pool.get('res.currency.rate') companies = self.pool.get('res.company').search(cr, uid, []) for comp in self.pool.get('res.company').browse(cr, uid, companies): - ##the multi company currency can beset or no so we handle + ##the multi company currency can beset or no so we handle ##the two case if not comp.auto_currency_up : continue @@ -212,12 +204,12 @@ class Currency_rate_update(osv.Model): 'rate':res[curr.name], 'name': rate_name } - rate_obj.create( + rate_obj.create( cr, uid, vals, ) - + note = note + "\n%s currency updated. "\ %(datetime.strftime(datetime.today(), '%Y-%m-%d %H:%M:%S')) note = note + (log_info or '') @@ -227,11 +219,11 @@ class Currency_rate_update(osv.Model): %(datetime.strftime(datetime.today(), '%Y-%m-%d %H:%M:%S'), str(e)) _logger.info(str(e)) service.write({'note':error_msg}) - + ### Error Definition as specified in python 2.6 PEP -class AbstractClassError(Exception): +class AbstractClassError(Exception): def __str__(self): return 'Abstract Class' def __repr__(self): @@ -243,25 +235,25 @@ class AbstractMethodError(Exception): def __repr__(self): return 'Abstract Method' -class UnknowClassError(Exception): +class UnknowClassError(Exception): def __str__(self): return 'Unknown Class' def __repr__(self): return 'Unknown Class' -class UnsuportedCurrencyError(Exception): +class UnsuportedCurrencyError(Exception): def __init__(self, value): self.curr = value def __str__(self): return 'Unsupported currency '+self.curr def __repr__(self): return 'Unsupported currency '+self.curr - -### end of error definition + +### end of error definition class Currency_getter_factory(): - """Factory pattern class that will return + """Factory pattern class that will return a currency getter class base on the name passed to the register method""" - def register(self, class_name): + def register(self, class_name): allowed = [ 'Admin_ch_getter', 'PL_NBP_getter', @@ -275,60 +267,60 @@ class Currency_getter_factory(): return class_def() else : raise UnknowClassError - + class Curreny_getter_interface(object) : "Abstract class of currency getter" - + #remove in order to have a dryer code # def __init__(self): - # raise AbstractClassError - + # raise AbstractClassError + log_info = " " - + supported_currency_array = \ ['AFN', 'ALL', 'DZD', 'USD', 'USD', 'USD', 'EUR', 'AOA', 'XCD', 'XCD', 'ARS', -'AMD', 'AWG', 'AUD', 'EUR', 'AZN', 'EUR', 'BSD', 'BHD', 'EUR', 'BDT', 'BBD', -'XCD', 'BYR', 'EUR', 'BZD', 'XOF', 'BMD', 'BTN', 'INR', 'BOB', 'ANG', 'BAM', -'BWP', 'NOK', 'BRL', 'GBP', 'USD', 'USD', 'BND', 'BGN', 'XOF', 'MMK', 'BIF', -'XOF', 'USD', 'KHR', 'XAF', 'CAD', 'EUR', 'CVE', 'KYD', 'XAF', 'XAF', 'CLP', -'CNY', 'AUD', 'AUD', 'COP', 'XAF', 'KMF', 'XPF', 'XAF', 'CDF', 'NZD', 'CRC', -'HRK', 'CUP', 'ANG', 'EUR', 'CYP', 'CZK', 'DKK', 'DJF', 'XCD', 'DOP', 'EUR', -'XCD', 'IDR', 'USD', 'EGP', 'EUR', 'SVC', 'USD', 'GBP', 'XAF', 'ETB', 'ERN', -'EEK', 'ETB', 'EUR', 'FKP', 'DKK', 'FJD', 'EUR', 'EUR', 'EUR', 'XPF', 'XPF', -'EUR', 'XPF', 'XAF', 'GMD', 'GEL', 'EUR', 'GHS', 'GIP', 'XAU', 'GBP', 'EUR', -'DKK', 'XCD', 'XCD', 'EUR', 'USD', 'GTQ', 'GGP', 'GNF', 'XOF', 'GYD', 'HTG', -'USD', 'AUD', 'BAM', 'EUR', 'EUR', 'HNL', 'HKD', 'HUF', 'ISK', 'INR', 'IDR', -'XDR', 'IRR', 'IQD', 'EUR', 'IMP', 'ILS', 'EUR', 'JMD', 'NOK', 'JPY', 'JEP', -'JOD', 'KZT', 'AUD', 'KES', 'AUD', 'KPW', 'KRW', 'KWD', 'KGS', 'LAK', 'LVL', -'LBP', 'LSL', 'ZAR', 'LRD', 'LYD', 'CHF', 'LTL', 'EUR', 'MOP', 'MKD', 'MGA', -'EUR', 'MWK', 'MYR', 'MVR', 'XOF', 'EUR', 'MTL', 'FKP', 'USD', 'USD', 'EUR', -'MRO', 'MUR', 'EUR', 'AUD', 'MXN', 'USD', 'USD', 'EUR', 'MDL', 'EUR', 'MNT', -'EUR', 'XCD', 'MAD', 'MZN', 'MMK', 'NAD', 'ZAR', 'AUD', 'NPR', 'ANG', 'EUR', -'XCD', 'XPF', 'NZD', 'NIO', 'XOF', 'NGN', 'NZD', 'AUD', 'USD', 'NOK', 'OMR', -'PKR', 'USD', 'XPD', 'PAB', 'USD', 'PGK', 'PYG', 'PEN', 'PHP', 'NZD', 'XPT', -'PLN', 'EUR', 'STD', 'USD', 'QAR', 'EUR', 'RON', 'RUB', 'RWF', 'STD', 'ANG', -'MAD', 'XCD', 'SHP', 'XCD', 'XCD', 'EUR', 'XCD', 'EUR', 'USD', 'WST', 'EUR', -'SAR', 'SPL', 'XOF', 'RSD', 'SCR', 'SLL', 'XAG', 'SGD', 'ANG', 'ANG', 'EUR', -'EUR', 'SBD', 'SOS', 'ZAR', 'GBP', 'GBP', 'EUR', 'XDR', 'LKR', 'SDG', 'SRD', -'NOK', 'SZL', 'SEK', 'CHF', 'SYP', 'TWD', 'RUB', 'TJS', 'TZS', 'THB', 'IDR', -'TTD', 'XOF', 'NZD', 'TOP', 'TTD', 'TND', 'TRY', 'TMM', 'USD', 'TVD', 'UGX', -'UAH', 'AED', 'GBP', 'USD', 'USD', 'UYU', 'USD', 'UZS', 'VUV', 'EUR', 'VEB', +'AMD', 'AWG', 'AUD', 'EUR', 'AZN', 'EUR', 'BSD', 'BHD', 'EUR', 'BDT', 'BBD', +'XCD', 'BYR', 'EUR', 'BZD', 'XOF', 'BMD', 'BTN', 'INR', 'BOB', 'ANG', 'BAM', +'BWP', 'NOK', 'BRL', 'GBP', 'USD', 'USD', 'BND', 'BGN', 'XOF', 'MMK', 'BIF', +'XOF', 'USD', 'KHR', 'XAF', 'CAD', 'EUR', 'CVE', 'KYD', 'XAF', 'XAF', 'CLP', +'CNY', 'AUD', 'AUD', 'COP', 'XAF', 'KMF', 'XPF', 'XAF', 'CDF', 'NZD', 'CRC', +'HRK', 'CUP', 'ANG', 'EUR', 'CYP', 'CZK', 'DKK', 'DJF', 'XCD', 'DOP', 'EUR', +'XCD', 'IDR', 'USD', 'EGP', 'EUR', 'SVC', 'USD', 'GBP', 'XAF', 'ETB', 'ERN', +'EEK', 'ETB', 'EUR', 'FKP', 'DKK', 'FJD', 'EUR', 'EUR', 'EUR', 'XPF', 'XPF', +'EUR', 'XPF', 'XAF', 'GMD', 'GEL', 'EUR', 'GHS', 'GIP', 'XAU', 'GBP', 'EUR', +'DKK', 'XCD', 'XCD', 'EUR', 'USD', 'GTQ', 'GGP', 'GNF', 'XOF', 'GYD', 'HTG', +'USD', 'AUD', 'BAM', 'EUR', 'EUR', 'HNL', 'HKD', 'HUF', 'ISK', 'INR', 'IDR', +'XDR', 'IRR', 'IQD', 'EUR', 'IMP', 'ILS', 'EUR', 'JMD', 'NOK', 'JPY', 'JEP', +'JOD', 'KZT', 'AUD', 'KES', 'AUD', 'KPW', 'KRW', 'KWD', 'KGS', 'LAK', 'LVL', +'LBP', 'LSL', 'ZAR', 'LRD', 'LYD', 'CHF', 'LTL', 'EUR', 'MOP', 'MKD', 'MGA', +'EUR', 'MWK', 'MYR', 'MVR', 'XOF', 'EUR', 'MTL', 'FKP', 'USD', 'USD', 'EUR', +'MRO', 'MUR', 'EUR', 'AUD', 'MXN', 'USD', 'USD', 'EUR', 'MDL', 'EUR', 'MNT', +'EUR', 'XCD', 'MAD', 'MZN', 'MMK', 'NAD', 'ZAR', 'AUD', 'NPR', 'ANG', 'EUR', +'XCD', 'XPF', 'NZD', 'NIO', 'XOF', 'NGN', 'NZD', 'AUD', 'USD', 'NOK', 'OMR', +'PKR', 'USD', 'XPD', 'PAB', 'USD', 'PGK', 'PYG', 'PEN', 'PHP', 'NZD', 'XPT', +'PLN', 'EUR', 'STD', 'USD', 'QAR', 'EUR', 'RON', 'RUB', 'RWF', 'STD', 'ANG', +'MAD', 'XCD', 'SHP', 'XCD', 'XCD', 'EUR', 'XCD', 'EUR', 'USD', 'WST', 'EUR', +'SAR', 'SPL', 'XOF', 'RSD', 'SCR', 'SLL', 'XAG', 'SGD', 'ANG', 'ANG', 'EUR', +'EUR', 'SBD', 'SOS', 'ZAR', 'GBP', 'GBP', 'EUR', 'XDR', 'LKR', 'SDG', 'SRD', +'NOK', 'SZL', 'SEK', 'CHF', 'SYP', 'TWD', 'RUB', 'TJS', 'TZS', 'THB', 'IDR', +'TTD', 'XOF', 'NZD', 'TOP', 'TTD', 'TND', 'TRY', 'TMM', 'USD', 'TVD', 'UGX', +'UAH', 'AED', 'GBP', 'USD', 'USD', 'UYU', 'USD', 'UZS', 'VUV', 'EUR', 'VEB', 'VEF', 'VND', 'USD', 'USD', 'USD', 'XPF', 'MAD', 'YER', 'ZMK', 'ZWD'] ##updated currency this arry will contain the final result updated_currency = {} - + def get_updated_currency(self, currency_array, main_currency, max_delta_days) : """Interface method that will retrieve the currency This function has to be reinplemented in child""" raise AbstractMethodError - + def validate_cur(self, currency) : """Validate if the currency to update is supported""" if currency not in self.supported_currency_array : - raise UnsuportedCurrencyError(currency) - + raise UnsuportedCurrencyError(currency) + def get_url(self, url): """Return a string of a get url query""" try: @@ -354,11 +346,11 @@ class Curreny_getter_interface(object) : _logger.warning("the rate date from ECB (%s) is not today's date", rate_date_str) -#Yahoo ################################################################################### +#Yahoo ################################################################################### class Yahoo_getter(Curreny_getter_interface) : """Implementation of Currency_getter_factory interface for Yahoo finance service""" - + def get_updated_currency(self, currency_array, main_currency, max_delta_days): """implementation of abstract method of Curreny_getter_interface""" self.validate_cur(main_currency) @@ -373,7 +365,7 @@ class Yahoo_getter(Curreny_getter_interface) : self.updated_currency[curr] = val else : raise Exception('Could not update the %s'%(curr)) - + return self.updated_currency, self.log_info # empty string added by polish changes ##Admin CH ############################################################################ class Admin_ch_getter(Curreny_getter_interface) : diff --git a/currency_rate_update/currency_rate_update.xml b/currency_rate_update/currency_rate_update.xml old mode 100755 new mode 100644 index ffa889199..db73b7fbb --- a/currency_rate_update/currency_rate_update.xml +++ b/currency_rate_update/currency_rate_update.xml @@ -1,6 +1,6 @@ - - + + Update Rates service currency.rate.update.service @@ -12,7 +12,7 @@ - + Update Rates currency.rate.update.service @@ -23,10 +23,10 @@ - + - + diff --git a/currency_rate_update/security/security.xml b/currency_rate_update/security/security.xml old mode 100755 new mode 100644