This module could be useful, but there are all sort of problems in code. Like, __public__ = True you meant: self.__public__ = True ?
After fixing that I get: AttributeError: 'tuple' object has no attribute 'args' on line return [ a for a in getargspec(self.method).args if (a != "self") ] This could be a version dependent problem ... or code was just not tested? And AFAIK, in Python code style guidelines assignment operator shouldn't be spaced like this: self.instance = instance I'll need to do some fixes and tweaks before using it, but thanks for contributing. On Jun 4, 8:43 pm, BenW <benwil...@gmail.com> wrote: > I made a few changes to make it a bit more general-purpose. It now > uses @publicmethod instead of the horrific public__ notation. > However, the dispatcher class just checks if method.__class__.__name__ > == 'publicmethod' and __public__ == True inside it. > > This seems a bit odd but I'm not sure how to make it cleaner. > Suggestions are welcome! > > Thanks, > > Ben > > On Jun 4, 7:47 am, BenW <benwil...@gmail.com> wrote: > > > > > Ahh yes, I had not considered calling them from Python since in my use > > case they are treated more like an extension into the browser than > > anything else. I will definitely refactor the class to use > > @publicmethod so as to make the instance containing RPC methods more > > general-purpose. > > > Thanks for the input! > > > Ben > > > On Jun 4, 12:02 am, Artem Egorkine <art...@gmail.com> wrote: > > > > On Wed, Jun 3, 2009 at 9:18 PM, BenW <benwil...@gmail.com> wrote: > > > > > Sorry about the example having bad syntax (doh!) -- I will get that > > > > fixed. I chose the public__ prefix because it makes it easier to > > > > introspect the supplied instance to find the methods intended to be > > > > public without forcing users of the class to provide a list > > > > themselves. You can put the class anywhere you want, I just stuck it > > > > in the view to keep it all together in the view. The RPC methods > > > > defined in that class are only used in that view. > > > > > And certainly the public__ prefix isn't any more unnatural than the > > > > ORM's query syntax. > > > > In your programming experience where, how many times have you found > > > yourself > > > reshuffling methods and making them public or private when refactoring the > > > API? Now imagine that you have methods calling other methods and you made > > > one of them public or private. You will now need to look up all references > > > to it and rename those calls as well... > > > > - Artem --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---