# HG changeset patch
# User terom
# Date 1194549960 0
# Node ID d9d1f8e5f384d1baa17b13d4a3dc6da7c327ecea
# Parent 156cdfffef8ef4da223f71507d98e5a0eeda615d
fix alignment of teh paginator, and make shorturl dirs better (no index.html + pagination)
diff -r 156cdfffef8e -r d9d1f8e5f384 degal.py
--- a/degal.py Thu Nov 08 19:09:05 2007 +0000
+++ b/degal.py Thu Nov 08 19:26:00 2007 +0000
@@ -449,9 +449,10 @@
pagination += '
Next »'
pagination += ""
+ shorturl = "%s/%s" % (self.shorturl_code, cur_page+1)
else :
pagination = ''
-
+ shorturl = self.shorturl_code
# render to index.html
gallery_tpl.renderTo(self.pathFor(self._page_fname(cur_page)),
@@ -462,8 +463,8 @@
PAGINATION=pagination,
CONTENT="".join([i.thumbImgTag() for i in page]),
DESCR=self.descr,
- SHORTURL=self.inRoot('s', self.shorturl_code),
- SHORTURL_CODE=self.shorturl_code,
+ SHORTURL=self.inRoot('s', shorturl),
+ SHORTURL_CODE=shorturl,
)
# render images
diff -r 156cdfffef8e -r d9d1f8e5f384 shorturl.cgi
--- a/shorturl.cgi Thu Nov 08 19:09:05 2007 +0000
+++ b/shorturl.cgi Thu Nov 08 19:26:00 2007 +0000
@@ -7,14 +7,27 @@
vars = cgi.FieldStorage()
key = vars['key'].value
+
+if 'index' in vars :
+ index = int(vars['index'].value.lstrip('/'))
+else :
+ index = None
+
db = shelve.open('shorturls2', 'r')
try :
type, dirpath, fname = db[key]
- if type == 'dir' : fname = 'index'
+ if index :
+ if index > 1 :
+ fname += 'index_%s.html' % (index - 1)
- path = os.path.join(dirpath, fname) + '.html'
+ dirpath = '../%s' % dirpath
+
+ if type == 'img' :
+ fname += '.html'
+
+ path = os.path.join(dirpath, fname)
finally :
db.close()
diff -r 156cdfffef8e -r d9d1f8e5f384 style.css
--- a/style.css Thu Nov 08 19:09:05 2007 +0000
+++ b/style.css Thu Nov 08 19:26:00 2007 +0000
@@ -56,14 +56,16 @@
}
div.paginate {
+ padding-top: 20px;
height: 50px;
width: 100%;
text-align: center;
}
div.paginate ul {
- margin: 0px
+ margin: 0px;
padding: 0px;
+
line-height: 30px;
white-space: nowrap;
}