# 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/forms.py
# class MapSearchForm(forms.Form):
# class MapRenderingJobForm(forms.ModelForm):
#     class Meta:
# class MapPaperSizeForm(forms.Form):
# class MapRecreateForm(forms.Form):
# class MapCancelForm(forms.Form):
#     MODES = (('admin', _('Administrative boundary')),
#              ('bbox', _('Bounding box')))
#     ORIENTATION = (('portrait', _('Portrait')),
#                    ('landscape', _('Landscape')))
#     def __init__(self, *args, **kwargs):
#         def _build_papersize_description(p):
#     def clean(self):
#     def _check_osm_id(self, osm_id):
#     def clean(self):
#     def clean(self):


import django
import django.utils.translation
import feedparser
import datetime
import www.settings
import psycopg2
from django.core.urlresolvers import reverse
from models import MapRenderingJob
from www.maposmatic import gisdb
from www.maposmatic import forms
# published by the Free Software Foundation, either version 3 of the
# License, or any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.




def get_latest_blog_posts():
    f = feedparser.parse("http://news.maposmatic.org/?feed=rss2")
    return f.entries[:4]

def get_osm_database_last_update():
    """Returns the timestamp of the last PostGIS database update, which is
    placed into the maposmatic_admin table in the PostGIS database by the
    planet-update incremental update script."""

    cursor = None

    try:
        db = gisdb.get()
        if db is None:
            return None


# 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/forms.py
# class MapSearchForm(forms.Form):
# class MapRenderingJobForm(forms.ModelForm):
#     class Meta:
# class MapPaperSizeForm(forms.Form):
# class MapRecreateForm(forms.Form):
# class MapCancelForm(forms.Form):
#     MODES = (('admin', _('Administrative boundary')),
#              ('bbox', _('Bounding box')))
#     ORIENTATION = (('portrait', _('Portrait')),
#                    ('landscape', _('Landscape')))
#     def __init__(self, *args, **kwargs):
#         def _build_papersize_description(p):
#     def clean(self):
#     def _check_osm_id(self, osm_id):
#     def clean(self):
#     def clean(self):


# Path: www/maposmatic/context_processors.py
import django
import django.utils.translation
import feedparser
import datetime
import www.settings
import psycopg2
from django.core.urlresolvers import reverse
from models import MapRenderingJob
from www.maposmatic import gisdb
from www.maposmatic import forms

# published by the Free Software Foundation, either version 3 of the
# License, or any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.




def get_latest_blog_posts():
    f = feedparser.parse("http://news.maposmatic.org/?feed=rss2")
    return f.entries[:4]

def get_osm_database_last_update():
    """Returns the timestamp of the last PostGIS database update, which is
    placed into the maposmatic_admin table in the PostGIS database by the
    planet-update incremental update script."""

    cursor = None

    try:
        db = gisdb.get()
        if db is None:
            return None


        cursor = db.cursor()