"or" for "if" in getmodulename; shorter comment on backwards compatibiliy kwmap-templates
authorChristian Ebert <blacktrash@gmx.net>
Thu, 08 Feb 2007 06:52:40 +0100
branchkwmap-templates
changeset 126 47b45198a30d
parent 125 e09b070073b2
child 127 f88ecc1a41fa
"or" for "if" in getmodulename; shorter comment on backwards compatibiliy
hgkw/keyword.py
--- a/hgkw/keyword.py	Thu Feb 08 06:45:12 2007 +0100
+++ b/hgkw/keyword.py	Thu Feb 08 06:52:40 2007 +0100
@@ -72,11 +72,9 @@
 '''
  
 from mercurial.i18n import gettext as _
-# above line for backwards compatibility; can be changed to
-#   from mercurial.i18n import _
-# some day
+# above line for backwards compatibility of standalone version
+from mercurial import commands, cmdutil, templater, util
 from mercurial import context, filelog, revlog
-from mercurial import commands, cmdutil, templater, util
 from mercurial.node import bin
 import os.path, re, sys, time
 
@@ -98,9 +96,7 @@
     '''Makes sure pretxncommit-hook can import keyword module
     regardless of where its located.'''
     for k, v in sys.modules.iteritems():
-        if v is None:
-            continue
-        if not hasattr(v, '__file__'):
+        if v is None or not hasattr(v, '__file__'):
             continue
         if v.__file__.startswith(__file__):
             return k
@@ -121,7 +117,6 @@
                 '|'.join(re.escape(k) for k in self.templates.keys()))
         templater.common_filters['utcdate'] = utcdate
         self.t = cmdutil.changeset_templater(ui, repo, False, '', False)
-            
 
     def expand(self, mobj, path, node):
         '''Expands keyword using corresponding template.'''