开发者

pyamf exclude property not working on db.ReferenceProperty

开发者 https://www.devze.com 2023-02-13 13:39 出处:网络
I am using pyamf with google app engine. I am trying to exclude a property fr开发者_高级运维om the pyamf encoding. This is the syntax I am using:

I am using pyamf with google app engine. I am trying to exclude a property fr开发者_高级运维om the pyamf encoding. This is the syntax I am using:

class Comment(db.Model):
    class __amf__:
        exclude = ('article')
    article = db.ReferenceProperty(Article)
    comment = db.TextProperty()

This does not work on the ReferenceProperty but if I try the exclude property with the 'comment' attribute it works. I noticed that the exclude property worked on a ReferenceProperty that did not contain a class with another ReferenceProperty attribute. In this case the Article class holds another ReferenceProperty to a another class. Any idea what could be the problem?

Thanks in advance


Your problem seems to be, at least partly, one of syntax -- you want the following:

exclude = ('article',)

Single parentheses without commas in them are just parenthesized expressions; they are evaluated earlier but do not mean "this is a tuple literal" -- that requires a colon.

0

精彩评论

暂无评论...
验证码 换一张
取 消