[mapserver-commits] r13182 - trunk/mapserver/mapscript/python
svn at osgeo.org
svn at osgeo.org
Wed Feb 29 05:46:17 EST 2012
Author: unicoletti
Date: 2012-02-29 02:46:16 -0800 (Wed, 29 Feb 2012)
New Revision: 13182
Modified:
trunk/mapserver/mapscript/python/pymodule.i
Log:
resolve issue with Python 2.6 using named arguments and guarantee 2.5 compatibility #3940
Modified: trunk/mapserver/mapscript/python/pymodule.i
===================================================================
--- trunk/mapserver/mapscript/python/pymodule.i 2012-02-28 17:12:13 UTC (rev 13181)
+++ trunk/mapserver/mapscript/python/pymodule.i 2012-02-29 10:46:16 UTC (rev 13182)
@@ -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 map:
- self.p_map=map
- 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 layer:
- self.p_layer=layer
- 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