[Featureserver] Bugreport/Bugfix FeatureServer

crschmidt at metacarta.com crschmidt at metacarta.com
Mon Aug 25 20:26:36 EDT 2008


On Tue, Aug 26, 2008 at 02:20:43AM +0200, Frederik Ramm wrote:
> Hi Christopher,
> 
>    we (Jochen and myself at Geofabrik) have just used FeatureServer 
> with the SQLite backend for a small application.
> 
> There was a bug in the SQLite backend that would not allow any property 
> updates to stored features. It was possible to update the *geometry* and 
> it was possible to *create* properties, but not to update properties.

Frederik,

I'm forwarding this to the FeatureServer mailing list, where you can
feel free to follow up. I've never looked at or touched the sqlite code,
as it is maintained entirely by another FeatureServer contributor: It is
my hope that Brent will be able to address your concerns if he has any
questions.

Thank you for your contribution.

> Reason was that the "update" method expected feature_predicates to 
> return an array that alternatingly contained keys and values, but 
> instead the method returned an array with one string per k/v pair.
> 
> The attached patch against
> 
> __version__ = "$Id: SQLite.py 449 2008-03-29 01:34:04Z brentp $"
> 
> fixes this, rather unelegantly because written by a Python ignorant, but 
> probably better than nothing.
> 
> During our debugging attempts, we introduced lots of compile errors 
> (e.g. using sys.stderr without "import sys") and were a bit unhappy that 
> these did not lead to "500 Internal Server Error" return codes, but 
> resulted in nice and shiny "200 OK" codes, with the Python stack trace 
> in the body of the HTTP message. Maybe this can be fixed but we felt 
> unable to do so.

Were you using cgi? Both mod_python and wsgi do it right -- and I would
generally recommend using wsgi for minor testing. As far as my
investigations have shown, there is no way to set the error code with
Python CGI responses to 500. If you find any research that shows
otherwise, I'll gladly work to integrate a fix into the code.



> Bye
> Frederik
> 
> -- 
> Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"

> --- ./DataSource/SQLite.py      2008-08-24 21:14:56.000000000 +0200
> +++ /srv/featureserver/FeatureServer/DataSource/SQLite.py       2008-08-24 23:09:35.000000000 +0200
> @@ -111,17 +111,21 @@
> 
>      def feature_predicates (self, feature):
>          columns = self.column_names(feature)
> -        values  = self.value_formats(feature)
> +        values  = self.feature_values(feature)
>          predicates = []
>          for pair in zip(columns, values):
>              if pair[0] != self.geom_col:
> -                predicates.append(" %s = %s" % pair)
> +                predicates.append(pair[0])
> +                predicates.append(pair[1])
> +                #predicates.append(" %s = %s" % pair)
>              else:
> -                predicates.append(" %s = %s " % (self.geom_col, self.to_wkt(feature.geometry)))
> +                predicates.append(self.geom_col)
> +                predicates.append(self.to_wkt(feature.geometry))
> +                #predicates.append(" %s = %s " % (self.geom_col, self.to_wkt(feature.geometry)))
>          return predicates
> 
>      def feature_values (self, feature):
> -        return copy.deepcopy(feature.properties)
> +        return feature.properties.values()
> 
>      def to_wkt (self, geom):
>          def coords_to_wkt (coords):


-- 
Christopher Schmidt
MetaCarta



More information about the Featureserver mailing list