# Path: www/maposmatic/gisdb.py
# _DB = None
#         _DB = psycopg2.connect("dbname='%s' user='%s' host='%s' password='%s' port='%s'" %
#                                 (www.settings.GIS_DATABASE_NAME,
#                                  www.settings.GIS_DATABASE_USER,
#                                  www.settings.GIS_DATABASE_HOST,
#                                  www.settings.GIS_DATABASE_PASSWORD,
#                                  www.settings.GIS_DATABASE_PORT))
#         _DB = None
# def get():


from django.utils.translation import ugettext
from urllib import urlencode
from xml.etree.ElementTree import parse as XMLTree
from www.maposmatic import gisdb
import logging
import psycopg2
import urllib2
import ocitysmap
import www.settings
    import pprint, sys

        if details is None:
            entry["ocitysmap_params"] \
                = dict(valid=False,
                       reason="no-admin",
                       reason_text=ugettext("No administrative boundary details from GIS"))
        else:
            (osm_id, admin_level, table_name,
             valid, reason, reason_text) = details
            entry["ocitysmap_params"] \
                = dict(table=table_name, id=osm_id,
                       admin_level=admin_level,
                       valid=valid,
                       reason=reason,
                       reason_text=reason_text)
    else:
        entry["ocitysmap_params"] \
            = dict(valid=False,
                   reason="no-admin",
                   reason_text=ugettext("No administrative boundary"))

def _prepare_and_filter_entries(entries):
    """Try to retrieve additional OSM information for the given nominatim
    entries. Among the information, we try to determine the real ID in
    an OSM table for each of these entries. All these additional data
    are stored in the "ocitysmap_params" key of the entry."""

    if not www.settings.has_gis_database():
        return entries


# Path: www/maposmatic/gisdb.py
# _DB = None
#         _DB = psycopg2.connect("dbname='%s' user='%s' host='%s' password='%s' port='%s'" %
#                                 (www.settings.GIS_DATABASE_NAME,
#                                  www.settings.GIS_DATABASE_USER,
#                                  www.settings.GIS_DATABASE_HOST,
#                                  www.settings.GIS_DATABASE_PASSWORD,
#                                  www.settings.GIS_DATABASE_PORT))
#         _DB = None
# def get():


# Path: www/maposmatic/nominatim.py
from django.utils.translation import ugettext
from urllib import urlencode
from xml.etree.ElementTree import parse as XMLTree
from www.maposmatic import gisdb
import logging
import psycopg2
import urllib2
import ocitysmap
import www.settings
    import pprint, sys


        if details is None:
            entry["ocitysmap_params"] \
                = dict(valid=False,
                       reason="no-admin",
                       reason_text=ugettext("No administrative boundary details from GIS"))
        else:
            (osm_id, admin_level, table_name,
             valid, reason, reason_text) = details
            entry["ocitysmap_params"] \
                = dict(table=table_name, id=osm_id,
                       admin_level=admin_level,
                       valid=valid,
                       reason=reason,
                       reason_text=reason_text)
    else:
        entry["ocitysmap_params"] \
            = dict(valid=False,
                   reason="no-admin",
                   reason_text=ugettext("No administrative boundary"))

def _prepare_and_filter_entries(entries):
    """Try to retrieve additional OSM information for the given nominatim
    entries. Among the information, we try to determine the real ID in
    an OSM table for each of these entries. All these additional data
    are stored in the "ocitysmap_params" key of the entry."""

    if not www.settings.has_gis_database():
        return entries


    db = gisdb.get()