summaryrefslogtreecommitdiff
path: root/app/flask_extend.py
blob: 5096d17bcf88e0eb86a85d322fc0d8842f0a04b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import Flask as _Flask
from flask import Blueprint as _Blueprint

if not hasattr(_Flask, 'template_test'):
# model `template_test` -- introduced with flask-0.10
    class Flask(_Flask):
        def template_test(self, name=None):
            def decorator(f):
                self.add_template_test(f, name=name)
                return f
            return decorator

        def add_template_test(self, f, name=None):
            self.jinja_env.tests[name or f.__name__] = f

    class Blueprint(_Blueprint):
        def app_template_test(self, name=None):
            def decorator(f):
                self.add_app_template_test(f, name=name)
                return f
            return decorator

        def add_app_template_test(self, f, name=None):
            def register_template(state):
                state.app.jinja_env.tests[name or f.__name__] = f
            self.record_once(register_template)

else:
    Flask = _Flask
    Blueprint = _Blueprint

del _Flask, _Blueprint
>René 'Necoro' Neumann2-16/+14 2008-07-03Ported Notify pluginRené 'Necoro' Neumann4-37/+51 2008-07-03Remove xsd and -x cmdline optionRené 'Necoro' Neumann2-107/+1 2008-07-03Ported completelyRené 'Necoro' Neumann3-548/+54 2008-07-03Should show dependencies nowRené 'Necoro' Neumann2-82/+128 2008-07-03Use __slots__ for the PkgData class to save memoryRené 'Necoro' Neumann1-2/+3 2008-07-03New plugin system - first hackRené 'Necoro' Neumann2-420/+683 2008-06-30Now the new design is able to do the same as the old oneRené 'Necoro' Neumann3-168/+182 2008-06-30First draft of the new plugin windowRené 'Necoro' Neumann1-8/+172 2008-06-30Added stuff to plugin.pyRené 'Necoro' Neumann1-2/+24 2008-06-30Beautified some dialogsRené 'Necoro' Neumann1-6/+8 2008-06-30Only add a package to mergequeue if everything went fineRené 'Necoro' Neumann1-1/+1 2008-06-25Now load 22 versions when running the correct portageRené 'Necoro' Neumann4-8/+18 2008-06-25Added Package_22 and System_22René 'Necoro' Neumann4-5/+63