what's the differences between wsexpose & validate?

83 views
Skip to first unread message

Jianing Yang

unread,
Jun 28, 2013, 12:19:12 AM6/28/13
to pytho...@googlegroups.com
Hi, all

I am using WSME with Pecan. I found that there are two style exposing an API with validation.

1st, 

    @wsexpose(str, datetime.date, datetime.time)
    def get_one(self, d, t):
        return d.isoformat() + ' ' + t.isoformat()

2nd,

    @wsexpose(str)
    @validate(datetime.date, datetime.time)
    def get_one(self, d, t):
        return d.isoformat() + ' ' + t.isoformat()

So, what are the benefits to validate arguments using @validate?

Christophe de Vienne

unread,
Jun 28, 2013, 3:30:07 AM6/28/13
to pytho...@googlegroups.com
Hello,

I recommend using the @wsexpose decorator only.

The @validate decorator is here to make migration from TGWebServices
easy, and should be used only when porting code from it. It may be
deprecated in the future, although I do not think it will be removed
completely.


Regards,

Christophe

Le 28/06/2013 06:19, Jianing Yang a �crit :
> --
> You received this message because you are subscribed to the Google
> Groups "python-wsme" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to python-wsme...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages