Changeset 828f6fe in osmose-frontend


Ignore:
Timestamp:
Mar 18, 2014 10:08:59 PM (6 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
174aa79
Parents:
317f047
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (08/03/2014 22:16:31)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (18/03/2014 22:08:59)
Message:

Fix fetch osm feture on 404

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • static/map/Osmose.Editor.js

    r6c1de0e r828f6fe  
    3636          self.saveDialog.parent().find('.ui-dialog-buttonpane').hide(); 
    3737 
    38           self._upload(); 
     38          var comment = document.forms.editor_save_form.elements.comment.value, 
     39            source = document.forms.editor_save_form.elements.source.value, 
     40            type = document.forms.editor_save_form.elements.type.value 
     41            reuse_changeset = document.forms.editor_save_form.elements.reuse_changeset.checked; 
     42          self._upload(comment, source, type, reuse_changeset); 
    3943 
    4044          self.saveDialog.html(dialog_content); 
     
    9195  }, 
    9296 
    93   _upload: function () { 
     97  _upload: function (comment, source, type, reuse_changeset) { 
    9498    $.ajax({ 
    9599      url: '../editor/save', 
  • tools/utils.py

    r72ad8d8 r828f6fe  
    9090    if type == "way" and full: 
    9191        elem_url = os.path.join(elem_url, "full") 
    92     elem_io = urllib2.urlopen(elem_url) 
    93     osm_read = OsmSax.OsmSaxReader(elem_io) 
    94  
    95     return osm_read 
     92    try: 
     93        elem_io = urllib2.urlopen(elem_url) 
     94        osm_read = OsmSax.OsmSaxReader(elem_io) 
     95        return osm_read 
     96    except: 
     97        pass 
    9698 
    9799def fetch_osm_elem(type, id): 
    98100    osmdw = OsmSax.OsmDictWriter() 
    99101    osm_read = fetch_osm_data(type, id, full=False) 
    100     osm_read.CopyTo(osmdw) 
    101     elem = osmdw.data[type] 
    102     if len(elem) > 0: 
    103         return elem[0] 
     102    if osm_read: 
     103        osm_read.CopyTo(osmdw) 
     104        elem = osmdw.data[type] 
     105        if len(elem) > 0: 
     106            return elem[0] 
Note: See TracChangeset for help on using the changeset viewer.