# -*- coding: utf-8 -*-

"""WebHelpers used in SkyLines."""

from __future__ import absolute_import

import datetime
import simplejson as json
from urllib import urlencode

from tg import flash
from webhelpers import date, feedgenerator, html, number, misc, text

from .string import *
from .country import *
from skylines.lib.formatter.numbers import *
from skylines.lib.formatter.datetime import *
from skylines.lib.formatter.units import *
from skylines.lib.markdown import markdown

# The dict implementation of Jinja2 only works for keyword parameters,
# but not for merging to dictionaries. We export the builtin Python dict()
# function here to get around that problem for building URLs.
dict = dict

# Jinja2 doesn't seem to have min/max... strange!
min = min
max = max


def url(base_url='/', params={}):
    if not isinstance(base_url, basestring) and hasattr(base_url, '__iter__'):
        base_url = '/'.join(base_url)

    if params:
        return '?'.join((base_url, urlencode(params)))

    return base_url

# -*- coding: utf-8 -*-

"""WebHelpers used in SkyLines."""

from __future__ import absolute_import

import datetime
import simplejson as json
from urllib import urlencode

from flask import flash
from webhelpers import date, feedgenerator, html, number, misc, text

from .string import *
from .country import *
from skylines.lib.formatter.numbers import *
from skylines.lib.formatter.datetime import *
from skylines.lib.formatter.units import *
from skylines.lib.markdown import markdown

# The dict implementation of Jinja2 only works for keyword parameters,
# but not for merging to dictionaries. We export the builtin Python dict()
# function here to get around that problem for building URLs.
dict = dict

# Jinja2 doesn't seem to have min/max... strange!
min = min
max = max


def url(base_url='/', params={}):
    if not isinstance(base_url, basestring) and hasattr(base_url, '__iter__'):
        base_url = '/'.join(base_url)

    if params:
        return '?'.join((base_url, urlencode(params)))

    return base_url

Use flask.flash instead of tg.flash
lib/helpers: Use flask.flash instead of tg.flash
