[mapserver-users] Add a validation block using python mapscript

Andrea Peri aperi2007 at gmail.com
Thu Jan 14 02:26:55 PST 2016


Thx Thomas ,
I find the right function name.
It is
updateFromString()
now the function is callable, but have another kind of error:

Traceback (most recent call last):
  File "generatore_mapfile_istat.py", line 192, in <module>
    theLayer.updateFromString(tempValidation)
  File "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
ne 1568, in updateFromString
    def updateFromString(self, *args): return _mapscript.layerObj_updateFromStri
ng(self, *args)
EOFError: loadLayer(): Premature End-of-File.

A.


2016-01-14 11:18 GMT+01:00 thomas bonfort <thomas.bonfort at gmail.com>:
> mapscript is camelcase
>
> On 14 January 2016 at 10:51, Andrea Peri <aperi2007 at gmail.com> wrote:
>>
>> Hi Thomas,
>> Thx for reply, I don't know this sintax.
>>
>> I try this:
>>
>>     theLayer = clone_map.getLayer(li)
>>     tempValidation = "VALIDATION 'idtpn' '^[a-zA-Z0-9\-_#]+$'
>> 'default_idtpn' '%' END"
>>     theLayer.updatefromstring(tempValidation)
>>
>> But it return an error:
>>
>> Traceback (most recent call last):
>>   File "generatore_mapfile_istat.py", line 192, in <module>
>>     theLayer.updatefromstring(tempValidation)
>>   File
>> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
>> ne 1385, in <lambda>
>>     __getattr__ = lambda self, name: _swig_getattr(self, layerObj, name)
>>   File
>> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
>> ne 54, in _swig_getattr
>>     raise AttributeError(name)
>> AttributeError: updatefromstring
>>
>> A.
>>
>>
>> 2016-01-14 10:38 GMT+01:00 thomas bonfort <thomas.bonfort at gmail.com>:
>> > if there is no mapscript interface for VALIDATION you can always use
>> >
>> > layer->updatefromstring("VALIDATION etc END")
>> >
>> > --
>> > thomas
>> >
>> > On 14 January 2016 at 10:33, Andrea Peri <aperi2007 at gmail.com> wrote:
>> >>
>> >> Hi,
>> >>
>> >> Is possible , using the python mapscript add a block for validation
>> >> like
>> >> this ?
>> >>
>> >>     VALIDATION
>> >>       'idtpn' '^[a-zA-Z0-9\-_#]+$'
>> >>       'default_idtpn' '%'
>> >>     END
>> >>
>> >>
>> >> --
>> >> -----------------
>> >> Andrea Peri
>> >> . . . . . . . . .
>> >> qwerty àèìòù
>> >> -----------------
>> >> _______________________________________________
>> >> mapserver-users mailing list
>> >> mapserver-users at lists.osgeo.org
>> >> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> >
>> >
>>
>>
>>
>> --
>> -----------------
>> Andrea Peri
>> . . . . . . . . .
>> qwerty àèìòù
>> -----------------
>
>



-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------


More information about the mapserver-users mailing list