author | Tero Marttila <terom@fixme.fi> |
Wed, 03 Jun 2009 20:33:15 +0300 | |
branch | use-distutils |
changeset 48 | 20355dd2e61a |
parent 41 | 3b1579a7bffb |
permissions | -rwxr-xr-x |
22
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
1 |
#!/usr/bin/env python2.5 |
12
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
2 |
# |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
3 |
# DeGAL - A pretty simple web image gallery |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
4 |
# Copyright (C) 2007 Tero Marttila |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
5 |
# http://marttila.de/~terom/degal/ |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
6 |
# |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
7 |
# This program is free software; you can redistribute it and/or modify |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
8 |
# it under the terms of the GNU General Public License as published by |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
9 |
# the Free Software Foundation; either version 2 of the License, or |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
10 |
# (at your option) any later version. |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
11 |
# |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
12 |
# This program is distributed in the hope that it will be useful, |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
15 |
# GNU General Public License for more details. |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
16 |
# |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
18 |
# along with this program; if not, write to the |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
19 |
# Free Software Foundation, Inc., |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
20 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
21 |
# |
c2d8e9a754a1
Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
9
diff
changeset
|
22 |
|
18
46536daf9e04
fix bug with shorturls in gallery.html, and some horrible, horrible crap for the CGI stuff - I need to drop everything now and take a fresh look tomorrow before it gets even worse
terom
parents:
17
diff
changeset
|
23 |
import inc |
22
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
24 |
from lib import shorturl, req |
6
d9d1f8e5f384
fix alignment of teh paginator, and make shorturl dirs better (no index.html + pagination)
terom
parents:
5
diff
changeset
|
25 |
|
22
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
26 |
key = req.get_str('key') |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
27 |
index = req.get_int('index', None) |
9
a0a13d5e406c
ShortURLs for dirs without page numbers were broken, as fname was 'index'
terom
parents:
6
diff
changeset
|
28 |
|
22
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
29 |
path = shorturl.html_path(key) |
6
d9d1f8e5f384
fix alignment of teh paginator, and make shorturl dirs better (no index.html + pagination)
terom
parents:
5
diff
changeset
|
30 |
|
22
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
31 |
if path : |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
32 |
print "Status: 302" |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
33 |
print "Location: ../%s" % path |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
34 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
35 |
print "../%s" % path |
18
46536daf9e04
fix bug with shorturls in gallery.html, and some horrible, horrible crap for the CGI stuff - I need to drop everything now and take a fresh look tomorrow before it gets even worse
terom
parents:
17
diff
changeset
|
36 |
|
22
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
37 |
else : |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
38 |
print "Status: 404" |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
39 |
|
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
40 |
print "404" |
72696ca68c34
use sqlite3 instead of bdb, series and shorturl should still work with this (adding new images won't yet)
terom
parents:
19
diff
changeset
|
41 |