[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15587] branches/soc-2008-quorn/release/ scripts: Missed some error types and cases from previous commit

Ian Thompson quornian at googlemail.com
Tue Jul 15 18:58:04 CEST 2008


Revision: 15587
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15587
Author:   quorn
Date:     2008-07-15 18:57:21 +0200 (Tue, 15 Jul 2008)

Log Message:
-----------
Missed some error types and cases from previous commit

Modified Paths:
--------------
    branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py
    branches/soc-2008-quorn/release/scripts/textplugin_suggest.py

Modified: branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py
===================================================================
--- branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py	2008-07-15 12:55:20 UTC (rev 15586)
+++ branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py	2008-07-15 16:57:21 UTC (rev 15587)
@@ -235,8 +235,7 @@
 			# Handle special case of 'import *'
 			if impname == '*':
 				parent = get_module(fromname)
-				for symbol, attr in parent.__dict__.items():
-					imports[symbol] = attr
+				imports.update(parent.__dict__)
 				
 			else:
 				# Try importing the name as a module
@@ -246,12 +245,12 @@
 					else:
 						module = get_module(impname)
 					imports[symbol] = module
-				except (ImportError, ValueError):
+				except (ImportError, ValueError, AttributeError, TypeError):
 					# Try importing name as an attribute of the parent
 					try:
 						module = __import__(fromname, globals(), locals(), [impname])
 						imports[symbol] = getattr(module, impname)
-					except (ImportError, ValueError, AttributeError):
+					except (ImportError, ValueError, AttributeError, TypeError):
 						pass
 			
 			# More to import from the same module?
@@ -286,7 +285,6 @@
 	step = 0
 	
 	for type, string, start, end, line in tokens:
-		print string
 		
 		# Look for 'def'
 		if step == 0:

Modified: branches/soc-2008-quorn/release/scripts/textplugin_suggest.py
===================================================================
--- branches/soc-2008-quorn/release/scripts/textplugin_suggest.py	2008-07-15 12:55:20 UTC (rev 15586)
+++ branches/soc-2008-quorn/release/scripts/textplugin_suggest.py	2008-07-15 16:57:21 UTC (rev 15587)
@@ -16,10 +16,20 @@
 	OK = False
 
 def check_membersuggest(line, c):
-	return c > 0 and line[c-1] == '.'
+	pos = line.rfind('.', 0, c)
+	if pos == -1:
+		return False
+	for s in line[pos+1:c]:
+		if not s.isalnum() and not s == '_':
+			return False
+	return True
 
 def check_imports(line, c):
-	return line.rfind('import ', 0, c) == c-7 or line.rfind('from ', 0, c) == c-5
+	if line.rfind('import ', 0, c) == c-7:
+		return True
+	if line.rfind('from ', 0, c) == c-5:
+		return True
+	return False
 
 def main():
 	txt = bpy.data.texts.active





More information about the Bf-blender-cvs mailing list