[Mapserver-users] Python MapScript: setting string attributes to None

Sean Gillies sgillies at frii.com
Fri Mar 28 15:35:02 EST 2003


Dear Mapserving Pythoneers,

For some time we've been enduring the inconvenience that
string attributes of map objects (such as layer.group),
once set, cannot be undefined.  This is due to a quirk in
the Python wrapper code that SWIG emits.

I've just committed into CVS a fix for this problem.  Part
of the fix is in mapscript.i so, unless you are comfortable
with using SWIG, you may have to wait a while until the
nightly system creates an updated Python wrapper code.  The
rest of the fix relies on a new setup script called
'setup_wnone.py'.

After rebuilding and installing the Python MapScript using
setup_wnone.py, you will be able to undefine string attributes
of your map objects with statements like:

    thelayer.[ATTRIBUTE] = None

This update to Python MapScript affects _only_ attributes
that are accessed directly (through __setattr__).  For attributes
like a class expression, continue to use

    theclass.setExpression('')

to undefine the expression.  For color attributes, continue to
use statements like

    null = colorObj()
    null.red, null.green, null.blue = (-1, -1, -1)
    theclass.styles.outlinecolor = null

peace,
Sean

--
Sean Gillies
sgillies at frii.com
http://www.frii.com/~sgillies




More information about the mapserver-users mailing list