Browse Source

r1085@denkpolster: jan | 2008-04-04 22:07:37 +0200

work on SQLite support (fixes #9)
  * correctly handle unicode output of SQLite (gpgmail.py)
  * only use schema for PostgreSQL databases (settings.py)
  * make SQLite and PostgreSQL mandatory (migrate.cfg)
  * add SQLite SQL to database version 1 of dbrepo


git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/trunk@249 a67ec6bc-e5d5-0310-a910-815c51eb3124
master
Jan Dittberner 14 years ago
parent
commit
cccc6b8fe3
  1. 2
      data/dbrepo/migrate.cfg
  2. 0
      data/dbrepo/versions/1/1.sqlite.downgrade.sql
  3. 0
      data/dbrepo/versions/1/1.sqlite.upgrade.sql
  4. 6
      gnuviechadmin/backend/settings.py
  5. 7
      gnuviechadmin/util/gpgmail.py

2
data/dbrepo/migrate.cfg

@ -17,4 +17,4 @@ version_table=migrate_version
# entire commit will fail. List the databases your application will actually
# be using to ensure your updates to that database work properly.
# This must be a list; example: ['postgres','sqlite']
required_dbs=[]
required_dbs=['postgres', 'sqlite']

0
data/dbrepo/versions/1/1.sqlite.downgrade.sql

0
data/dbrepo/versions/1/1.sqlite.upgrade.sql

6
gnuviechadmin/backend/settings.py

@ -1,3 +1,4 @@
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007, 2008 by Jan Dittberner.
@ -23,13 +24,16 @@ import ConfigParser, os, string, logging.config
# global settings which must not be user configurable
required_version = 3
dbschema = 'gva'
# load user configuration
config = ConfigParser.ConfigParser()
config.readfp(open('gnuviechadmin/defaults.cfg'))
config.read(['gnuviechadmin/gva.cfg', os.path.expanduser('~/.gva.cfg')])
dbschema = None
if config.get('database', 'uri').startswith('postgres://'):
dbschema = 'gva'
def get_template_dir(dirname):
"""Returns the template directory for the given directory."""
templatepath = config.get('common', 'templatedir')

7
gnuviechadmin/util/gpgmail.py

@ -1,6 +1,7 @@
# -*- coding: UTF-8 -*-
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 by Jan Dittberner.
# Copyright (C) 2007, 2008 by Jan Dittberner.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -30,6 +31,8 @@ def send_mail(subject, text):
"""This method sends a mail with the given text and subject
and signs it usign GnuPG. If a public key of the recipient is
available the mail is encrypted."""
if not text.__class__.__name__ == 'str':
text = text.encode('ascii', 'replace')
plain = core.Data(text)
cipher = core.Data()
c = core.Context()

Loading…
Cancel
Save