File: __init__.py

package info (click to toggle)
python-pecan 0.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,372 kB
  • ctags: 1,832
  • sloc: python: 9,048; makefile: 144; sh: 85
file content (28 lines) | stat: -rw-r--r-- 692 bytes parent folder | download
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
import os
from mimetypes import guess_type
from contextlib import closing
from base64 import b64encode

from pecan.compat import quote


def load_resource(filename):
    with closing(open(
        os.path.join(
            os.path.dirname(__file__),
            filename
        ),
        'rb'
    )) as f:
        data = f.read()
        return 'data:%s;base64,%s' % (
            guess_type(filename)[0],
            quote(b64encode(data))
        )

pecan_image = load_resource('pecan.png')
xregexp_js = load_resource('XRegExp.js')
syntax_js = load_resource('shCore.js')
syntax_css = load_resource('syntax.css')
theme = load_resource('theme.css')
brush = load_resource('brush-python.js')