pylons
Covered: 1 lines
Missed: 24 lines
Skipped 10 lines
Percent: 4 %

     1

    """Base objects to be exported for use in Controllers"""

     2

    from paste.registry import StackedObjectProxy

     3

     4

    from pylons.configuration import config

     5

     6

    __all__ = ['app_globals', 'cache', 'config', 'request', 'response',

     7

               'session', 'tmpl_context', 'url']

     8

     9

    def __figure_version():

    10

        try:

    11

            from pkg_resources import require

    12

            import os

    13

            # NOTE: this only works when the package is either installed,

    14

            # or has an .egg-info directory present (i.e. wont work with raw

    15

            # SVN checkout)

    16

            info = require('pylons')[0]

    17

            if os.path.dirname(os.path.dirname(__file__)) == info.location:

    18

                return info.version

    19

            else:

    20

                return '(not installed)'

    21

        except:

    22

            return '(not installed)'

    23

    24

    __version__ = __figure_version()

    25

    26

    app_globals = StackedObjectProxy(name="app_globals")

    27

    cache = StackedObjectProxy(name="cache")

    28

    request = StackedObjectProxy(name="request")

    29

    response = StackedObjectProxy(name="response")

    30

    session = StackedObjectProxy(name="session")

    31

    tmpl_context = StackedObjectProxy(name="tmpl_context or C")

    32

    url = StackedObjectProxy(name="url")

    33

    34

    translator = StackedObjectProxy(name="translator")

    35