author | terom |
Wed, 16 Jan 2008 18:44:03 +0000 | |
changeset 22 | 72696ca68c34 |
child 24 | 001f52cd057e |
permissions | -rw-r--r-- |
22
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
1 |
# DeGAL - A pretty simple web image gallery |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
2 |
# Copyright (C) 2007 Tero Marttila |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
3 |
# http://marttila.de/~terom/degal/ |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
4 |
# |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
5 |
# This program is free software; you can redistribute it and/or modify |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
6 |
# it under the terms of the GNU General Public License as published by |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
7 |
# the Free Software Foundation; either version 2 of the License, or |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
8 |
# (at your option) any later version. |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
9 |
# |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
10 |
# This program is distributed in the hope that it will be useful, |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
13 |
# GNU General Public License for more details. |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
14 |
# |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
15 |
# You should have received a copy of the GNU General Public License |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
16 |
# along with this program; if not, write to the |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
17 |
# Free Software Foundation, Inc., |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
18 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
19 |
# |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
20 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
21 |
import sqlite3 |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
22 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
23 |
conn = sqlite3.connect("degal.db") |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
24 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
25 |
def execute (expr, *args) : |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
26 |
c = conn.cursor() |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
27 |
c.execute(expr, args) |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
28 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
29 |
return c |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
30 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
31 |
def insert (expr, *args) : |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
32 |
return execute(expr, *args).rowcount |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
33 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
34 |
select = execute |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
35 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
36 |
cursor = conn.cursor |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
diff
changeset
|
37 |