summaryrefslogtreecommitdiff
path: root/pecan/util.py
blob: aa2e683a1c8b5ab5a357dfd50600c4fa7432c295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sys


def iscontroller(obj):
    return getattr(obj, 'exposed', False)


def _cfg(f):
    if not hasattr(f, '_pecan'):
        f._pecan = {}
    return f._pecan


if sys.version_info >= (2, 6, 5):
    def encode_if_needed(s):
        return s
else:
    def encode_if_needed(s):  # noqa
        return s.encode('utf-8')