Re: Prevent a method from being called
Irmen de Jong <[email protected]> Fri, 30 May 2014 00:41:18 +0200
| Newsgroups | gmane.comp.python.pyro |
|---|---|
| Message-ID | <[email protected]> |
On 29-5-2014 17:21, hjxwho wrote: > Hello, > Is it possible there is a way to prevent an existing method from being called > because this method is only avaliable to the server? > Thank you, > Klaus Depends on what you mean by "preventing" the method being called. You can use the double underscore way to make methods 'private' to your class, like you do in regular python code. But they will only be obfuscated (name mangled) so technically it is fairly trivial to still access them if you really want. Another way that really prevents them from being called is to create a wrapper or 'api' class that only contains the exact methods you want to expose, and let it delegate them to the actual object. Then register the wrapper class instead of your actual class with Pyro. Irmen ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet