summaryrefslogtreecommitdiff
path: root/chimere/utils.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2012-11-24 02:09:54 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2012-11-24 02:09:54 +0100
commit9edddaf1cce657e97f3550565e446d9a91e69fce (patch)
tree53bd093c4245b221f8d4d7f578f6a021cdec3e38 /chimere/utils.py
parent1b30395108ad1d9dd42e286ca04e534fa928e679 (diff)
downloadChimère-9edddaf1cce657e97f3550565e446d9a91e69fce.tar.bz2
Chimère-9edddaf1cce657e97f3550565e446d9a91e69fce.zip
Fix rapprochement - work on OSM export interface
Diffstat (limited to 'chimere/utils.py')
-rw-r--r--chimere/utils.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/chimere/utils.py b/chimere/utils.py
index ed41a04..25b5900 100644
--- a/chimere/utils.py
+++ b/chimere/utils.py
@@ -67,7 +67,7 @@ class ImportManager:
def get(self):
pass
- def put(self):
+ def put(self, extra_args={}):
pass
def create_or_update_item(self, cls, values, import_key, version=None,
@@ -721,7 +721,7 @@ class OSMManager(ImportManager):
items.append(item)
return (new_item, updated_item, msg)
- def put(self):
+ def put(self, extra_args={}):
# first of all: reimport in order to verify that no changes has been
# made since the last import
from models import Marker
@@ -735,9 +735,19 @@ class OSMManager(ImportManager):
return 0, _(u"There are items from a former import not yet "
u"validated - validate them before exporting")
# start import
- api = OsmApi.OsmApi(api=settings.CHIMERE_OSM_API_URL,
- username=settings.CHIMERE_OSM_USER,
- password=settings.CHIMERE_OSM_PASSWORD)
+ api = settings.CHIMERE_OSM_API_URL
+ username = settings.CHIMERE_OSM_USER
+ password = settings.CHIMERE_OSM_PASSWORD
+ if extra_args:
+ try:
+ api = extra_args['api']
+ username = extra_args['username']
+ password = extra_args['password']
+ except KeyError:
+ return 0, _(u"Bad params - programming error")
+ api = OsmApi.OsmApi(api=api,
+ username=username,
+ password=password)
api.ChangesetCreate({u"comment": u"Import from Chimère %s" % \
get_version()})
hooks = RE_HOOK.findall(self.importer_instance.filtr)