1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-06 22:05:09 +01:00

More refactoring and some fixes

This commit is contained in:
2018-10-15 17:49:27 +02:00
parent 51b94e4b64
commit 9712b269ff
4 changed files with 9 additions and 8 deletions

View File

@@ -1,6 +1,5 @@
from __future__ import print_function from __future__ import print_function
import binascii
import datetime import datetime
import gzip import gzip
import hashlib import hashlib
@@ -37,15 +36,10 @@ except ImportError:
APP_ROOT = os.path.dirname(os.path.realpath(__file__)) APP_ROOT = os.path.dirname(os.path.realpath(__file__))
MEDIA_ROOT = os.path.join(APP_ROOT, 'static') MEDIA_ROOT = os.path.join(APP_ROOT, 'static')
MEDIA_URL = '/static/' MEDIA_URL = '/static/'
DATABASE = {
'name': os.path.join(APP_ROOT, 'bookmarks.db'),
'engine': 'peewee.SqliteDatabase',
}
# create our flask app and a database wrapper # create our flask app and a database wrapper
app = Flask(__name__) app = Flask(__name__)
app.config.from_object(__name__) app.config.from_object(__name__)
database = SqliteDatabase(os.path.join(APP_ROOT, 'bookmarks.db'))
# Strip unnecessary whitespace due to jinja2 codeblocks # Strip unnecessary whitespace due to jinja2 codeblocks
app.jinja_env.trim_blocks = True app.jinja_env.trim_blocks = True

View File

@@ -2,6 +2,7 @@
import binascii import binascii
import os import os
import datetime
from peewee import * # noqa from peewee import * # noqa
@@ -16,6 +17,12 @@ except ImportError:
from urlparse import urljoin, urlparse, urlunparse from urlparse import urljoin, urlparse, urlunparse
DATABASE_PATH = os.path.dirname(os.path.realpath(__file__))
if 'DIGIMARKS_DB_PATH' in os.environ:
DATABASE_PATH = os.environ['DIGIMARKS_DB_PATH']
database = SqliteDatabase(os.path.join(DATABASE_PATH, 'bookmarks.db'))
def ifilterfalse(predicate, iterable): def ifilterfalse(predicate, iterable):
# ifilterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8 # ifilterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8
if predicate is None: if predicate is None:

View File

@@ -1,4 +1,4 @@
"""digimarks theme definitions" """digimarks theme definitions"""
DEFAULT_THEME = 'freshgreen' DEFAULT_THEME = 'freshgreen'
themes = { themes = {

View File

@@ -1,2 +1,2 @@
"""digimarks views" """digimarks views"""