Browse files

Merge branch 'master' into i18n

Conflicts:
	molly/apps/places/providers/osm.py
  • Loading branch information...
2 parents 4766967 + 05d3127 commit 77b44dbbba8ddbfedf82678b05e719ef32a53952 @cnorthwood cnorthwood committed May 27, 2011
Showing with 28 additions and 12 deletions.
  1. +5 −5 molly/apps/places/providers/osm.py
  2. +23 −7 molly/apps/places/templates/places/metadata/osm.html
View
10 molly/apps/places/providers/osm.py
@@ -167,7 +167,7 @@ def endElement(self, name):
entity.metadata['osm'] = {
'attrs': dict(self.attrs),
- 'tags': self.tags
+ 'tags': dict(zip((k.replace(':', '-') for k in self.tags.keys()), self.tags.values()))
}
entity.primary_type = self.entity_types[types[0]]
@@ -389,9 +389,9 @@ def disambiguate_titles(self, source):
entities = Entity.objects.filter(source=source)
inferred_names = {}
if '-' in lang_code:
- tags_to_try = ('name:%s' % lang_code, 'name:%s' % lang_code.split('-')[0], 'name', 'operator')
+ tags_to_try = ('name-%s' % lang_code, 'name-%s' % lang_code.split('-')[0], 'name', 'operator')
else:
- tags_to_try = ('name:%s' % lang_code, 'name', 'operator')
+ tags_to_try = ('name-%s' % lang_code, 'name', 'operator')
for entity in entities:
inferred_name = None
for tag_to_try in tags_to_try:
@@ -407,8 +407,8 @@ def disambiguate_titles(self, source):
for inferred_name, entities in inferred_names.items():
if len(entities) > 1:
for entity in entities:
- if entity.metadata['osm']['tags'].get('addr:street'):
- title = u"%s, %s" % (inferred_name, entity.metadata['osm']['tags'].get('addr:street'))
+ if entity.metadata['osm']['tags'].get('addr-street'):
+ title = u"%s, %s" % (inferred_name, entity.metadata['osm']['tags'].get('addr-street'))
else:
try:
place_name = reverse_geocode(entity.location[0], entity.location[1])[0]['name']
View
30 molly/apps/places/templates/places/metadata/osm.html
@@ -1,6 +1,6 @@
{% load molly_osm %}{% load molly_utils %}
-{% if entity|osm_tags or entity.metadata.osm.tags.phone or entity.metadata.osm.tags.wikipedia or entity.metadata.osm.tags.url %}
+{% if entity|osm_tags or entity.metadata.osm.tags.phone or entity.metadata.osm.tags.wikipedia or entity.metadata.osm.tags.website-mobile or entity.metadata.osm.tags.website or entity.metadata.osm.tags.url %}
<div class="section">
<div class="header">
@@ -35,12 +35,28 @@
</a>
</li>
{% endif %}
- {% if entity.metadata.osm.tags.url %}
- <li>
- <a class="external" href="{{ entity.metadata.osm.tags.url|escape }}">
- Website
- </a>
- </li>
+ {% if entity.metadata.osm.tags.website-mobile %}
+ <li>
+ <a class="external" href="{{ entity.metadata.osm.tags.website-mobile|escape }}">
+ Website
+ </a>
+ </li>
+ {% else %}
+ {% if entity.metadata.osm.tags.website %}
+ <li>
+ <a class="external" href="{{ entity.metadata.osm.tags.website|escape }}">
+ Website
+ </a>
+ </li>
+ {% else %}
+ {% if entity.metadata.osm.tags.url %}
+ <li>
+ <a class="external" href="{{ entity.metadata.osm.tags.url|escape }}">
+ Website
+ </a>
+ </li>
+ {% endif %}
+ {% endif %}
{% endif %}
<li>
<a href="{% url places:entity-update entity.identifier_scheme entity.identifier_value %}">

0 comments on commit 77b44db

Please sign in to comment.