]> git.llucax.com Git - software/blitiri.git/commitdiff
Don't store leading slashes for paths in the article's DB
authorLeandro Lucarella <luca@llucax.com.ar>
Wed, 6 Aug 2008 17:07:11 +0000 (14:07 -0300)
committerAlberto Bertogli <albertito@blitiri.com.ar>
Fri, 8 Aug 2008 22:53:20 +0000 (19:53 -0300)
blitiri.cgi

index a20da86be83fc5da521f9b56d1d735de4f7e92a8..0e2aea6da68051a1575281f5990c0f9904635b79 100755 (executable)
@@ -335,8 +335,12 @@ class Article (object):
 
 
        def load(self):
-               # os.path.join ignore other paths if one starts with a slash
-               filename = os.path.join(data_path, self.path[1:])
+               # XXX this tweak is only needed for old DB format, where
+               # article's paths started with a slash
+               path = self.path
+               if path.startswith('/'):
+                       path = path[1:]
+               filename = os.path.join(data_path, path)
                try:
                        raw = open(filename).readlines()
                except:
@@ -637,7 +641,7 @@ def handle_cmd():
                print "Error: article (%s) must be inside data_path (%s)" % \
                                (art_path, data_path)
                return 1
-       art_path = art_path[len(data_path):]
+       art_path = art_path[len(data_path)+1:]
 
        db_filename = os.path.join(data_path, 'db')
        if not os.path.isfile(db_filename):