Git Product home page Git Product logo

changemonger's People

Contributors

emacsen avatar gioele avatar samatjain avatar thomasg77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

changemonger's Issues

Improve unicode handling

Calling encode('utf-8') is a Bad Idea (tm) - there should be unicode objects flowing from the beginning of time.

So for example in changemonger.py:

xml = et.XML(data.encode('utf-8')) should be xml = et.XML(data)

Of course this will cause problems in the XML parser but this can be fixed by making Python Requests return unicode string instead of str. Like this (in osmapi.py):

return r.text should be return r.content (see http://stackoverflow.com/questions/11210973/python-requests-unicode-error)

This will make coding other API implementations (such as osmdbapi I'm working on right now) much easier - just assume that getNode, getWay etc. all return unicode objects.

I can submit a patch for this if you want.

Allow app.py to be bound to a specific address

Currently app.py binds to 127.0.0.1:5000. For those of us who browse from a different IP than we run python programs, this does not work.

Command line options to specify the port and IP would be useful and eliminate the need to edit app.py.

Some XML breaks ElementTree

Changeset 12742250 causes a crash in elementree:

Traceback (most recent call last):
File "/home/serge/.virtualenvs/changemonger/lib/python2.7/site-packages/flask/app.py", line 1701, in call
return self.wsgi_app(environ, start_response)
File "/home/serge/.virtualenvs/changemonger/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/serge/.virtualenvs/changemonger/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
response = self.full_dispatch_request()
File "/home/serge/.virtualenvs/changemonger/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/serge/.virtualenvs/changemonger/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
rv = self.dispatch_request()
File "/home/serge/.virtualenvs/changemonger/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/serge/changemonger/app.py", line 89, in display_changeset
cset = helpers.get_changeset_or_404(id)
File "/home/serge/changemonger/helpers.py", line 38, in get_changeset_or_404
return changemonger.changeset(id)
File "/home/serge/changemonger/changemonger.py", line 65, in changeset
xml = et.XML(data)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1301, in XML
parser.feed(text)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1641, in feed
self._parser.Parse(data, 0)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 472: ordinal not in range(128)

Ruby?

Dumb question perhaps, but would it ever be a goal for changemonger to be usable in the rails port directly as a gem (and thus, yes, sigh, lame, a ruby port)? Or is the architecture more like a multi-server system?

Drop "unnamed" from descriptions

Right now some descriptions are like "XXX edited unnamed fence" :-) I think just "XXX edited a fence" would be enough. In fact I can't see for what features "unnamed" would make sense.

TypeError: %u format: a number is required, not str

ERROR:__main__:Exception on /api/changeset/13440094 [GET] Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "./app.py", line 143, in show_changeset sentence = changemonger.changeset_sentence(cset) File "/stuff/src/osm/osm-activity-publishers/changeset-publisher/changemonger/changemonger.py", line 106, in changeset_sentence english_list = elements.grouped_to_english(sorted_features) File "/stuff/src/osm/osm-activity-publishers/changeset-publisher/changemonger/elements.py", line 111, in grouped_to_english l.append(display_name(elements[0], feature)) File "/stuff/src/osm/osm-activity-publishers/changeset-publisher/changemonger/elements.py", line 60, in display_name return common_name(ele) File "/stuff/src/osm/osm-activity-publishers/changeset-publisher/changemonger/elements.py", line 44, in common_name return("%u %u" % (a, ele['tags']['operator'])) TypeError: %u format: a number is required, not str

Index out of range error

While running changemonger through app.py on changeset 13175649 I got the following error:


DEBUG:root:Retrieving http://api.openstreetmap.org/api/0.6/node/770584876/relations for node 770584876 relations
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/0.6/node/770584876/relations HTTP/1.1" 200 184
DEBUG:root:Retrieving http://api.openstreetmap.org/api/0.6/node/770584878/relations for node 770584878 relations
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/0.6/node/770584878/relations HTTP/1.1" 200 184
DEBUG:root:Retrieving http://api.openstreetmap.org/api/0.6/node/770584881/relations for node 770584881 relations
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/0.6/node/770584881/relations HTTP/1.1" 200 184
INFO:werkzeug:192.168.1.4 - - [19/Sep/2012 14:16:33] "GET /changeset?id=13175649 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/pnorman/osm/changemonger-env/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/pnorman/osm/changemonger-env/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/pnorman/osm/changemonger-env/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pnorman/osm/changemonger-env/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pnorman/osm/changemonger-env/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pnorman/osm/changemonger-env/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/pnorman/osm/changemonger/app.py", line 88, in display_changeset
    sentence = changemonger.changeset_sentence(cset)
  File "/home/pnorman/osm/changemonger/changemonger.py", line 90, in changeset_sentence
    ele_features = zip(eles, db.matchEach(eles))
  File "/home/pnorman/osm/changemonger/features.py", line 288, in matchEach
    return [self.matchAllSolo(ele) for ele in coll]
  File "/home/pnorman/osm/changemonger/features.py", line 282, in matchAllSolo
    if feature.match(ele):
  File "/home/pnorman/osm/changemonger/features/magic.py", line 45, in match
    return (self._typecheck(ele) and ele['nd'][0] == ele['nd'][-1])
IndexError: list index out of range

In the debugger I ran dump()

>>> dump()
Local variables in frame

self    
<magic.UnidentifiedPolygon instance at 0x23add40>
ele 
{'changeset': '13175649', 'uid': '651207', 'tags': {}, 'timestamp': '2012-09-19T20:45:53Z', 'nd': [], '_tags': [], 'visible': 'false', 'version': '2', 'user': 'Peter 111', 'type': 'way', 'id': '165596414'  }
>>> dump(self)
Details for instance object at 0x23add40

<magic.UnidentifiedPolygon instance at 0x23add40>
__doc__ 
None
__init__    
<bound method UnidentifiedPolygon.__init__ of <magic.UnidentifiedPolygon instance at 0x23add40>>
__module__  
'magic'
_prominence 
0
_typecheck  
<bound method UnidentifiedPolygon._typecheck of <magic.UnidentifiedPolygon instance at 0x23add40>>
categories  
[]
category    
<bound method UnidentifiedPolygon.category of <magic.UnidentifiedPolygon instance at 0x23add40>>
id  
u'37412160'
match   
<bound method UnidentifiedPolygon.match of <magic.UnidentifiedPolygon instance at 0x23add40>>
name    
'unidentified polygon'
named   
True
plural  
'unidentified polygons'
precision   
3
types   
['way']

Make Changemonger deleted element aware

Since the OSM API doesn't return deleted objects on a normal API call, if CM requests such an object, the request will fail (or at best, the object won't show up).

This should be fixed.

parser module name conflict

In Python 2.7.2, the parser module which is include by changemonger is the builtin library module rather than the parser.py module in this library.

Possibly this should be renamed, or possibly I just have an include problem? Changemonger itself imports fine when running from a /test dir.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.