[mapserver-commits] r13288 - in branches/branch-6-0/mapserver: . mapscript/python

svn at osgeo.org svn at osgeo.org
Tue Mar 20 12:24:18 EDT 2012


Author: aboudreault
Date: 2012-03-20 09:24:18 -0700 (Tue, 20 Mar 2012)
New Revision: 13288

Modified:
   branches/branch-6-0/mapserver/HISTORY.TXT
   branches/branch-6-0/mapserver/mapscript/python/pymodule.i
Log:
Fixed Python MapScript layerObj/classObj Error (#3940)

Modified: branches/branch-6-0/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-6-0/mapserver/HISTORY.TXT	2012-03-20 16:11:12 UTC (rev 13287)
+++ branches/branch-6-0/mapserver/HISTORY.TXT	2012-03-20 16:24:18 UTC (rev 13288)
@@ -15,6 +15,8 @@
 Current Version (future 6.0.3, SVN branch-6-0):
 ---------------------------
 
+- Fixed Python MapScript layerObj/classObj Error (#3940)
+
 - Fixed WCS 2.0 axis order, offset vector, and origin (#4006, #4191)
 
 - Fixed PHP MapScript opacity property of StyleObj no longer works (#3920)

Modified: branches/branch-6-0/mapserver/mapscript/python/pymodule.i
===================================================================
--- branches/branch-6-0/mapserver/mapscript/python/pymodule.i	2012-03-20 16:11:12 UTC (rev 13287)
+++ branches/branch-6-0/mapserver/mapscript/python/pymodule.i	2012-03-20 16:24:18 UTC (rev 13288)
@@ -159,18 +159,30 @@
 /* The bogus "if 1:" is to introduce a new scope to work around indentation
    handling with pythonappend in different versions.  (#3180) */
 %feature("pythonappend") layerObj %{if 1:
-	  if args and len(args)!=0:
-		self.p_map=args[0]
-	  else:
-		self.p_map=None%}
+            self.p_map=None
+            try:
+                # python 2.5
+                if args and len(args)!=0: 
+                    self.p_map=args[0]
+            except NameError:
+                # python 2.6
+                if map: 
+                    self.p_map=map
+       %}
 
 /* The bogus "if 1:" is to introduce a new scope to work around indentation
    handling with pythonappend in different versions. (#3180) */
 %feature("pythonappend") classObj %{if 1:
-	   if args and len(args)!=0:
-		self.p_layer=args[0]
-	   else:
-		self.p_layer=None%}
+            self.p_layer =None
+            try:
+                # python 2.5
+                if args and len(args)!=0: 
+                    self.p_layer=args[0]
+            except NameError:
+                # python 2.6
+                if layer: 
+                    self.p_layer=layer
+       %}
 
 %feature("shadow") insertClass %{
 	def insertClass(*args):



More information about the mapserver-commits mailing list