|
Idea: Provide a custom method annotation vs. this services hash/object. Right now, if you don't have a method defined in your services object, PyAMF can't map the method and returns the nice fault telling you so. AMFPHP used to do the same thing, but then in PHP5, I think they assume any method that's "public" was publicly accessible; protected and private were not.
I thought Python 2.6 or whatever it was added annotations? Example is the Django one used for authentication vs. "if user.authenticated, blah blah blah". Would there be a way to do this for PyAMF? Or... is that not a Python norm? Just seems easier to me, when writing a method, to designate it as a Flash/Flex callable one. _______________________________________________ PyAMF users mailing list - [hidden email] http://lists.pyamf.org/mailman/listinfo/users |
|
This is something that I would love to implement.
Something like: from pyamf.remoting import ServiceMaker, service s = ServiceMaker('/url/for/gateway') authService = s.getNamespace('authService') @authService.map def login(username, password): pass so calling 'authService.login' at url '/url/for/gateway' will match to that function and everything just works. This might actually work .. any ideas for improving the api?
On Sunday, 3 April 2011 at 12:21 PM, Jesse Warden wrote:
_______________________________________________ PyAMF users mailing list - [hidden email] http://lists.pyamf.org/mailman/listinfo/users |
|
Whoa, I wasn't even thinking URL's, just the actual services (aka, what I put into NetConnection.call). Hrm... don't know.
From the simple perspective, going:
@pyamf def login(username, password): pass Is totally fine for me; aka, anytime Flash Player calls NetConnection.call("app.login"), it'd know to map login to that one method. Basically, instead of that Services hash at the bottom, @pyamf designates that as a publicly exposed method for everything in the current app's view.
I suck at Python & Django, so I'm pretty sure I'm missing the benefits of your URL example. One question, too; how do multiple annotations work? For example, in Flex, I can go:
[Bindable] [SkinPart] public var label:Label; And it becomes both a skin part AND a bindable variable. Could I use the above with Django's authenticate decorator?
from django.contrib.auth.decorators import login_required @login_required @authService.map def login(username, password):
pass On Mon, Apr 4, 2011 at 3:35 PM, Nick Joyce <[hidden email]> wrote:
_______________________________________________ PyAMF users mailing list - [hidden email] http://lists.pyamf.org/mailman/listinfo/users |
|
On Monday, 4 April 2011 at 7:18 PM, Jesse Warden wrote:
For remoting/RemoteObject (or indeed any HTTP based request), the url is required.
Yep, Python decorators are stackable. See docs at http://wiki.python.org/moin/PythonDecorators
_______________________________________________ PyAMF users mailing list - [hidden email] http://lists.pyamf.org/mailman/listinfo/users |
|
Hrm, as long as I can do what you wrote above, it looks good to me. I just define the url once in urls.py, and setup the services at the bottom of the views, but either way; not having to use that hash, and instead annotate each method would be great. What's the minimum version of Python needed to get this to work, 2.6?
On Mon, Apr 4, 2011 at 8:41 PM, Nick Joyce <[hidden email]> wrote:
_______________________________________________ PyAMF users mailing list - [hidden email] http://lists.pyamf.org/mailman/listinfo/users |
|
Yea, from a Django perspective, not defining the url twice would be awesome :-) Decorators in Python were introduced in 2.4 (so a looong time ago).
On Monday, 4 April 2011 at 8:10 PM, Jesse Warden wrote:
_______________________________________________ PyAMF users mailing list - [hidden email] http://lists.pyamf.org/mailman/listinfo/users |
|
Then if the support is good, the hell yes! I'm insecure about it because I'd like to use it, but don't know the deployment costs. If 2.4 is old skool, it seems it'd be low so bring it!
On Fri, Apr 8, 2011 at 2:11 PM, Nick Joyce <[hidden email]> wrote:
_______________________________________________ PyAMF users mailing list - [hidden email] http://lists.pyamf.org/mailman/listinfo/users |
| Powered by Nabble | Edit this page |
