Opened 21 years ago
Closed 21 years ago
#293 closed defect (fixed)
String attributes of mapping objects, once defined, cannot be undefined
Reported by: | Owned by: | sdlime | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | MapScript | Version: | 4.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
I'm going to use Python syntax in the description. Say we have a mapfile that contains a layer (index = 0) and that no group is defined for the layer. We then create a mapscript mapObj using this mapfile. When we try to access the 'group' attribute of the layer like layer = mapobj.getLayer(0) group = layer.group the variable 'group' has a value of None (or your own flavor of NULL). This is exactly right. Now, during use of the mapObj we might change the group attribute like layer.group = 'foo' and this works fine. However, we cannot now undefine the group attribute. The underlying SWIG accessor functions will not allow us to do this layer.group = None which would be the most Pythonesque way to undefine an attribute, because the layerObj_group_set function requires a string argument. Setting the group attribute to an empty string like layer.group = '' does not undefine the attribute. It's important to be able to undefine attributes because there are many functions in the mapserver that execute differently depending on whether or not string attributes evaluate as equal to NULL. I figure that there are two possible solutions: 1) Get the SWIG accessor functions to use typemaps that map our scripting languages None/NULL values to C NULLs. Unfortunately, I haven't been able to turn up any documentation or suggestions on how this would be done. 2) Refactor the mapserver code so that empty strings are treated as NULL. Are there better solutions?
Change History (1)
comment:1 by , 21 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Summary: | String attributes of mapping objects, once defined, cannot be undefined → String attributes of mapping objects, once defined, cannot be undefined |
Note:
See TracTickets
for help on using tickets.