Hi Ken,


On 01/15/13 00:33, Ken Prows wrote:
Hello,

I am having a lot of fun with spyne. I used to despise having to deal
with SOAP, but spyne changed that. (Part of that is also due to the
helpfulness of Burak on this list! :)


Thanks! I'm also having a lot of fun with Spyne, that may explain why :) 2.10 is going to be huge, I tell you :)

Anyway, I am wondering if there are any naming conventions regarding
how to name model classes, fields and methods. Does spyne prefer
camelcase or underscores?

Most of the examples have methods named with underscores. However,
when I get back a JsonDocument response, it seems to expect that the
methods were named using camelcase. As an example, I have a method
called "catalog_tree." When I get back the response for this method,
it looks like:

{"catalog_treeResponse": {"catalog_treeResult": { ... }}

So I am leaning toward naming my classes/methods using camelcase, and
my fields using underscores...unless there are some recommendations
regarding this.

Heh, that does look ugly doesn't it? Well, those prefixes have been the same since as far as I can remember, and I preferred not to touch them, as that'd almost completely change the generated WSDL for no good reason. However, being the kind who can't really stand inconsistencies in my code, this is the first thing my in-house library code does before everything else imports Spyne:

try:
    import spyne.const.suffix
    spyne.const.suffix.RESPONSE_SUFFIX = "_response"
    spyne.const.suffix.RESULT_SUFFIX = "_result"
    spyne.const.suffix.TYPE_SUFFIX = "_type"

except ImportError:
    pass


(hmmm. this must be from before I put the setters there. anyway...)

See here for details:

https://github.com/plq/spyne/blob/master/spyne/const/suffix.py

My humble suggestion in this regard would be to do as I do and follow PEP8, but hey, Spyne is your tool as much as it is mine, so it's going to be your decision.

Best regards,
Burak
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to