cgi-bin/inc.py
author terom
Sat, 22 Dec 2007 21:31:01 +0000
changeset 18 46536daf9e04
permissions -rw-r--r--
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
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:
diff changeset
     1
if __name__ == '__main__' :
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:
diff changeset
     2
    raise Exception("Don't access inc.py directly")
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:
diff changeset
     3
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:
diff changeset
     4
# setup env
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:
diff changeset
     5
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:
diff changeset
     6
import sys
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:
diff changeset
     7
import os, os.path
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:
diff changeset
     8
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:
diff changeset
     9
def splitn (path, n) :
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:
diff changeset
    10
    for i in xrange(0, n) :
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:
diff changeset
    11
        path = os.path.split(path)[0]      
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:
diff changeset
    12
    
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:
diff changeset
    13
    return path
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:
diff changeset
    14
        
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:
diff changeset
    15
degal_path = splitn(os.path.join(os.getcwd(), __file__), 2)
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:
diff changeset
    16
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:
diff changeset
    17
os.chdir(degal_path)
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:
diff changeset
    18
sys.path.append(degal_path)