Hi we, You need to familiarize yourself with the Protocol Buffer classes used internally. Reading the source is one option, as is experimenting on shell.appspot.com. You may find the Protocol Buffer definition handy: http://www.google.com/codesearch/p?hl=en&sa=N&cd=1&ct=rc#7VUv29z7Sc8/trunk/proto/datastore_v3.proto&q=file:datastore_v3.proto . Note that the version of Protocol Buffers used by App Engine does not have the same interface as the Open Source ones.
request.add_filter() is along the right lines, but MergeFromString is intended for merging from encoded Protocol Buffers, so won't understand your string. add_filter returns a Filter Protocol Buffer, on which you need to set the appropriate fields. -Nick Johnson On Mon, Jul 6, 2009 at 1:13 PM, we<[email protected]> wrote: > > Hi. I am trying to use the hook api in Python to intercept all calls > to the datastore and run a check to ensure that the user has proper > authorization to take the action requested - possibly by adding a > filter or by querying some other tables. As an example, when > displaying results, I would like to add some additoinal filters to the > query while in the hook. However, I cannot figure out how to add > these filters. I am using > apiproxy_stub_map.apiproxy.GetPreCallHooks. THe hook provides 4 > parameters - including an object that is a > google.appengine.datastore.datastore_pb.Query. How can I add an > additional filter to the query before it is run? > I have tried many different things - including: > > request.filter("title","test item") > request.add_filter().MergeFromString("title = test item") > > Thank you for your help. > > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
