]> oss.titaniummirror.com Git - webber.git/blobdiff - webber.py
webber.py: stop if requested plugin cannot be loaded
[webber.git] / webber.py
index 5cadaaff6c9736eefc0bc0b52224230972551de2..73f9e73d43eea65335428d6c94fa65292a1a8690 100644 (file)
--- a/webber.py
+++ b/webber.py
@@ -63,6 +63,7 @@ class File(Holder):
                Holder.__init__(self, **kw)
                files[kw["rel_path"]] = self
                self.render = None
+               self.contents = None
                mtime = os.stat(self.path)[stat.ST_MTIME]
                self.mtime = mtime
                self.ctime = mtime
@@ -80,7 +81,7 @@ class File(Holder):
                        if read_keywords:
                                s = s.strip()
                                #print "kwd:", s
-                               if s==terminate_line:
+                               if s == terminate_line:
                                        read_keywords = False
                                        continue
 
@@ -115,7 +116,7 @@ class File(Holder):
 
                # Warn about long titles / long linktitles
                if len(self.linktitle) > 20:
-                       log('%s: define a shorter "linktitle: xxx"')
+                       log('%s: define a shorter linktitle' % self.rel_path)
 
                self.contents = "".join(txt)
 
@@ -261,7 +262,7 @@ def get_program_directory():
 #      5... Debug
 #
 def log(s, level=4):
-       if level>4:
+       if level > 4:
                indent = " " * (level-4)
        else:
                indent = ""
@@ -338,11 +339,11 @@ def load_plugins():
        sys.path.append(os.path.join(get_program_directory(), "plugins"))
        for s in cfg.plugins:
                #print "import:", s
-               #try:
-               exec "import %s" % s
-               #except:
-               #       print "Could not import plugin '%s'" % s
-               #       sys.exit(1)
+               try:
+                       exec "import %s" % s
+               except:
+                       print "Could not import plugin '%s'" % s
+                       sys.exit(1)
 
 
 def set_hook(name, last=False):
@@ -434,7 +435,7 @@ def iso_to_time(val):
                try:
                        t = time.strptime(val, "%Y-%m-%d")
                except ValueError:
-                       warning("%s: wrong ISO format in '%s'" % (self.rel_path, s))
+                       warning("wrong ISO format in '%s'" % val)
        return int(time.mktime(t))
 
 @set_function("format_date")
@@ -608,11 +609,13 @@ def scan_files():
 
        for s in files:
                file = files[s]
-               try:
-                       # Just check if the file has contents
-                       contents = file.contents
-               except:
+               if not file.has_key("contents"):
                        continue
+#              try:
+#                      # Just check if the file has contents
+#                      contents = file.contents
+#              except:
+#                      continue
 
                direc = directories[file.direc]