Send data from flex to django

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Send data from flex to django

Frederico Vieira
Hi there.

I'm have a doubt for how best pratict to send data from flex to django. To receive in flex from django is easy, but my question is about send.

In Java/AS3 I have a remote class that mapped between two languages. This is possible with Django? I could send data via a http post, but perhaps there a better way to make this comunication between AS3 to Django.

If exists a guide for this, send for me.

Thanks!!

--
________________________
Frederico Vieira
SCJP - Sun Certified Java Programmer
"A natureza prática derruba a teórica. Welcome to the Django baby!"


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Thijs Triemstra
Hi Frederico,

you can certainly map Python/AS3 classes like you do in Java. For a  
general overview of the Django gateway in PyAMF check this page [1].  
For an actual example that uses class mapping, check the bytearray  
example [2]. And check the 'simple example' [3] for an example  
explaining class mapping in Python/AS3 with PyAMF.

hth,

Thijs

[1] http://docs.pyamf.org/current/tutorials/gateways/django.html
[2] http://pyamf.org/wiki/ByteArrayExample
[3] http://pyamf.org/wiki/SimpleExample

On 30 Nov 2009, at 19:56, Frederico Vieira wrote:

> Hi there.
>
> I'm have a doubt for how best pratict to send data from flex to  
> django. To receive in flex from django is easy, but my question is  
> about send.
>
> In Java/AS3 I have a remote class that mapped between two languages.  
> This is possible with Django? I could send data via a http post, but  
> perhaps there a better way to make this comunication between AS3 to  
> Django.
>
> If exists a guide for this, send for me.
>
> Thanks!!
>
> --
> ________________________
> Frederico Vieira
> SCJP - Sun Certified Java Programmer
> "A natureza prática derruba a teórica. Welcome to the Django baby!"
>
> _______________________________________________
> PyAMF users mailing list - [hidden email]
> http://lists.pyamf.org/mailman/listinfo/users

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users

PGP.sig (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Jesse Warden-2
In reply to this post by Frederico Vieira
I just send raw Objects (aka Java Pojo's).  You can map it like you can in Java via [RemoteClassAlias], but it was too hard for me to debug when something went wrong with nested classes.  Python/Django was really easy to work with Objects, and while I lose "strong-typing", the speed at which I could develop was better.

Sending looks something like this:


var powerObject:Object = power.toObject(true); PowerFactory.validateForDjango(powerObject); var service:RemoteObject = Services.instance.cloudService; var operation:Operation = service.getOperation("createPower") as Operation; var token:AsyncToken = operation.send(powerObject); token.addResponder(new Responder(onResult, onFault));

Notice my "power" above is a Flex ActionScript ValueObject.  In the beginning, I used to send it as-is, with the [RemoteClassAlias] metadata tag at the top, with matching classes in Python:

pyamf.register_class(Power, 'powerz.cloud.Power')

...the problem was, nested (VO's within VO's) were just to hard to get mapped correctly, so I gave up and used Objects instead.  So, all my VO's can be converted to a vanilla Object like so:

var powerObject:Object = power.toObject(true);

Which looks something like this:


The HUGE down-side to this is that you lose strong-typing, and once you misspell something, you get NO help from the compiler.  However, I'd argue it's faster (for me) to debug problems in ActionScript vs. Python's register classes error exceptions which usually bubbled up from the PyAMF parsers.  I couldn't read those things.....

Anyway, if your Object model is simple, I highly suggest you utilize the pyamf.register_class syntax, and [RemoteClassAlias("com.your.Class")] on the client side portion.




On Mon, Nov 30, 2009 at 2:56 PM, Frederico Vieira <[hidden email]> wrote:
Hi there.

I'm have a doubt for how best pratict to send data from flex to django. To receive in flex from django is easy, but my question is about send.

In Java/AS3 I have a remote class that mapped between two languages. This is possible with Django? I could send data via a http post, but perhaps there a better way to make this comunication between AS3 to Django.

If exists a guide for this, send for me.

Thanks!!

--
________________________
Frederico Vieira
SCJP - Sun Certified Java Programmer
"A natureza prática derruba a teórica. Welcome to the Django baby!"


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users



_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Nick Joyce
On 30 Nov 2009, at 20:45, Jesse Warden wrote:

I just send raw Objects (aka Java Pojo's).  You can map it like you can in Java via [RemoteClassAlias], but it was too hard for me to debug when something went wrong with nested classes.  Python/Django was really easy to work with Objects, and while I lose "strong-typing", the speed at which I could develop was better.

Sending looks something like this:


var powerObject:Object = power.toObject(true); PowerFactory.validateForDjango(powerObject); var service:RemoteObject = Services.instance.cloudService; var operation:Operation = service.getOperation("createPower") as Operation; var token:AsyncToken = operation.send(powerObject); token.addResponder(new Responder(onResult, onFault));

Notice my "power" above is a Flex ActionScript ValueObject.  In the beginning, I used to send it as-is, with the [RemoteClassAlias] metadata tag at the top, with matching classes in Python:

pyamf.register_class(Power, 'powerz.cloud.Power')

...the problem was, nested (VO's within VO's) were just to hard to get mapped correctly, so I gave up and used Objects instead.  So, all my VO's can be converted to a vanilla Object like so:

Can you expand on this a little? Is this related to static attributes/Django ORM (aka http://pyamf.org/ticket/677 ..)? PyAMF *should* be able to support as much complexity as you can throw at it ..


var powerObject:Object = power.toObject(true);

Which looks something like this:


The HUGE down-side to this is that you lose strong-typing, and once you misspell something, you get NO help from the compiler.  However, I'd argue it's faster (for me) to debug problems in ActionScript vs. Python's register classes error exceptions which usually bubbled up from the PyAMF parsers.  I couldn't read those things.....

Anyway, if your Object model is simple, I highly suggest you utilize the pyamf.register_class syntax, and [RemoteClassAlias("com.your.Class")] on the client side portion.

I am currently helping out on a project using GAE/PyAMF which is one of the most complex class/object/alias structures that I know of .. In fact it is the pretty much exercises all core parts of PyAMF (which is great for beta testing new versions ;-). So far things have worked out pretty well.

Cheers,

Nick

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Jesse Warden-2
You're good at Python, I'm not.  When something goes wrong in Flex, I can figure it out.  When something goes wrong in Python, I spend hours figuring out "an un-caught exception" vs. something that takes 2 seconds in ActionScript.  This is b/c I'm a n00b, and sabotaging strong-typing is quicker for me to get things done then figure out bizzarre stack-trace parser errors in PyAMF.

If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.

On Tue, Dec 1, 2009 at 2:57 PM, Nick Joyce <[hidden email]> wrote:
On 30 Nov 2009, at 20:45, Jesse Warden wrote:

I just send raw Objects (aka Java Pojo's).  You can map it like you can in Java via [RemoteClassAlias], but it was too hard for me to debug when something went wrong with nested classes.  Python/Django was really easy to work with Objects, and while I lose "strong-typing", the speed at which I could develop was better.

Sending looks something like this:


var powerObject:Object = power.toObject(true); PowerFactory.validateForDjango(powerObject); var service:RemoteObject = Services.instance.cloudService; var operation:Operation = service.getOperation("createPower") as Operation; var token:AsyncToken = operation.send(powerObject); token.addResponder(new Responder(onResult, onFault));

Notice my "power" above is a Flex ActionScript ValueObject.  In the beginning, I used to send it as-is, with the [RemoteClassAlias] metadata tag at the top, with matching classes in Python:

pyamf.register_class(Power, 'powerz.cloud.Power')

...the problem was, nested (VO's within VO's) were just to hard to get mapped correctly, so I gave up and used Objects instead.  So, all my VO's can be converted to a vanilla Object like so:

Can you expand on this a little? Is this related to static attributes/Django ORM (aka http://pyamf.org/ticket/677 ..)? PyAMF *should* be able to support as much complexity as you can throw at it ..


var powerObject:Object = power.toObject(true);

Which looks something like this:


The HUGE down-side to this is that you lose strong-typing, and once you misspell something, you get NO help from the compiler.  However, I'd argue it's faster (for me) to debug problems in ActionScript vs. Python's register classes error exceptions which usually bubbled up from the PyAMF parsers.  I couldn't read those things.....

Anyway, if your Object model is simple, I highly suggest you utilize the pyamf.register_class syntax, and [RemoteClassAlias("com.your.Class")] on the client side portion.

I am currently helping out on a project using GAE/PyAMF which is one of the most complex class/object/alias structures that I know of .. In fact it is the pretty much exercises all core parts of PyAMF (which is great for beta testing new versions ;-). So far things have worked out pretty well.

Cheers,

Nick

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users



_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Joel Hooks-2
On Dec 1, 2009, at 2:04 PM, Jesse Warden wrote:

> If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.

Just to clarify here, I use an older version of PyAMF and Django because of the way my client side is configured in relation to the Django ORM. In the rewrite I am currently building it is using the bleeding edge PyAMF with strongly typed complex nested objects. I'm ditching Django, because I wanted something lighter weight that was easier to run/test (TDD ftw!), but if I was rebuilding it with Django, I'd still take advantage of the ORM - it just wasn't available when I started my app.

My gripe is generally related to the client side lacking a persistence layer. This is a problem with ANY AMF remoting(or remoting in general, even with POPOs/POASOs). Adobe has done a really nice job writing the client side persistence bits with LCDS, and projects like DPHibernate and GraniteDS have solutions. AMFast has some support for this, but the client side is rigid and flimsy (yes, all at the same time). One of my goals for the first few months of next year is to really sit down and engineer a proper client side persistence library for PyAMF. The only thing I know for sure is I won't be calling objects fucking beans ;)

I don't miss Django at all, really. I don't build web pages, and the overhead/complexity was frustrating. It is an awesome framework, but way overkill if you just want to use Python for Flash remoting.

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Erik Wickstrom
Hi Joel,

What are you using instead of Django?  Roll your own, or some other framework?

Erik

On Fri, Dec 4, 2009 at 10:24 PM, Joel Hooks <[hidden email]> wrote:
On Dec 1, 2009, at 2:04 PM, Jesse Warden wrote:

> If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.

Just to clarify here, I use an older version of PyAMF and Django because of the way my client side is configured in relation to the Django ORM. In the rewrite I am currently building it is using the bleeding edge PyAMF with strongly typed complex nested objects. I'm ditching Django, because I wanted something lighter weight that was easier to run/test (TDD ftw!), but if I was rebuilding it with Django, I'd still take advantage of the ORM - it just wasn't available when I started my app.

My gripe is generally related to the client side lacking a persistence layer. This is a problem with ANY AMF remoting(or remoting in general, even with POPOs/POASOs). Adobe has done a really nice job writing the client side persistence bits with LCDS, and projects like DPHibernate and GraniteDS have solutions. AMFast has some support for this, but the client side is rigid and flimsy (yes, all at the same time). One of my goals for the first few months of next year is to really sit down and engineer a proper client side persistence library for PyAMF. The only thing I know for sure is I won't be calling objects fucking beans ;)

I don't miss Django at all, really. I don't build web pages, and the overhead/complexity was frustrating. It is an awesome framework, but way overkill if you just want to use Python for Flash remoting.

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Joel Hooks-2
CherryPy and SQLAlchemy. I don't really need a framework, just ORM. I felt that a full blown framework was completely overkill.

-j

On Dec 7, 2009, at 1:32 PM, Erik Wickstrom wrote:

> What are you using instead of Django?  Roll your own, or some other framework?

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Nick Joyce
In reply to this post by Joel Hooks-2
On 5 Dec 2009, at 06:24, Joel Hooks wrote:

> On Dec 1, 2009, at 2:04 PM, Jesse Warden wrote:
>
>> If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.
>
> Just to clarify here, I use an older version of PyAMF and Django because of the way my client side is configured in relation to the Django ORM. In the rewrite I am currently building it is using the bleeding edge PyAMF with strongly typed complex nested objects. I'm ditching Django, because I wanted something lighter weight that was easier to run/test (TDD ftw!), but if I was rebuilding it with Django, I'd still take advantage of the ORM - it just wasn't available when I started my app.
>
> My gripe is generally related to the client side lacking a persistence layer. This is a problem with ANY AMF remoting(or remoting in general, even with POPOs/POASOs). Adobe has done a really nice job writing the client side persistence bits with LCDS, and projects like DPHibernate and GraniteDS have solutions. AMFast has some support for this, but the client side is rigid and flimsy (yes, all at the same time). One of my goals for the first few months of next year is to really sit down and engineer a proper client side persistence library for PyAMF. The only thing I know for sure is I won't be calling objects fucking beans ;)

If its possible, could you detail exactly what problem the client side lib is meant to solve and how PyAMF fits in? I am a server bod and am having a big brainfart on the issue .. example code is probably easiest for me to grok, if it's easier to point me to a blog/tut.

BTW, Is anyone planning on heading to PyCon next year? Its in Atlanta Georgia @ Feb 19-21. I am 95% sure I am going this year (first time!) and would love to meet up with fellow Python/Fl[ash|ex] users. Just working out the finer travelling details ...

Cheers,

Nick
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Jesse Warden-2
They still accepting speakers?

On Tue, Dec 8, 2009 at 12:40 PM, Nick Joyce <[hidden email]> wrote:
On 5 Dec 2009, at 06:24, Joel Hooks wrote:

> On Dec 1, 2009, at 2:04 PM, Jesse Warden wrote:
>
>> If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.
>
> Just to clarify here, I use an older version of PyAMF and Django because of the way my client side is configured in relation to the Django ORM. In the rewrite I am currently building it is using the bleeding edge PyAMF with strongly typed complex nested objects. I'm ditching Django, because I wanted something lighter weight that was easier to run/test (TDD ftw!), but if I was rebuilding it with Django, I'd still take advantage of the ORM - it just wasn't available when I started my app.
>
> My gripe is generally related to the client side lacking a persistence layer. This is a problem with ANY AMF remoting(or remoting in general, even with POPOs/POASOs). Adobe has done a really nice job writing the client side persistence bits with LCDS, and projects like DPHibernate and GraniteDS have solutions. AMFast has some support for this, but the client side is rigid and flimsy (yes, all at the same time). One of my goals for the first few months of next year is to really sit down and engineer a proper client side persistence library for PyAMF. The only thing I know for sure is I won't be calling objects fucking beans ;)

If its possible, could you detail exactly what problem the client side lib is meant to solve and how PyAMF fits in? I am a server bod and am having a big brainfart on the issue .. example code is probably easiest for me to grok, if it's easier to point me to a blog/tut.

BTW, Is anyone planning on heading to PyCon next year? Its in Atlanta Georgia @ Feb 19-21. I am 95% sure I am going this year (first time!) and would love to meet up with fellow Python/Fl[ash|ex] users. Just working out the finer travelling details ...

Cheers,

Nick
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Nick Joyce
No, calls for speakers ended 1st Oct, but I believe that the lightning talks are still open (5 mins on whatever subject you want)


On 8 Dec 2009, at 17:43, Jesse Warden wrote:

They still accepting speakers?

On Tue, Dec 8, 2009 at 12:40 PM, Nick Joyce <[hidden email]> wrote:
On 5 Dec 2009, at 06:24, Joel Hooks wrote:

> On Dec 1, 2009, at 2:04 PM, Jesse Warden wrote:
>
>> If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.
>
> Just to clarify here, I use an older version of PyAMF and Django because of the way my client side is configured in relation to the Django ORM. In the rewrite I am currently building it is using the bleeding edge PyAMF with strongly typed complex nested objects. I'm ditching Django, because I wanted something lighter weight that was easier to run/test (TDD ftw!), but if I was rebuilding it with Django, I'd still take advantage of the ORM - it just wasn't available when I started my app.
>
> My gripe is generally related to the client side lacking a persistence layer. This is a problem with ANY AMF remoting(or remoting in general, even with POPOs/POASOs). Adobe has done a really nice job writing the client side persistence bits with LCDS, and projects like DPHibernate and GraniteDS have solutions. AMFast has some support for this, but the client side is rigid and flimsy (yes, all at the same time). One of my goals for the first few months of next year is to really sit down and engineer a proper client side persistence library for PyAMF. The only thing I know for sure is I won't be calling objects fucking beans ;)

If its possible, could you detail exactly what problem the client side lib is meant to solve and how PyAMF fits in? I am a server bod and am having a big brainfart on the issue .. example code is probably easiest for me to grok, if it's easier to point me to a blog/tut.

BTW, Is anyone planning on heading to PyCon next year? Its in Atlanta Georgia @ Feb 19-21. I am 95% sure I am going this year (first time!) and would love to meet up with fellow Python/Fl[ash|ex] users. Just working out the finer travelling details ...

Cheers,

Nick
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Jesse Warden-2
Shit.  Well, I'm not paying $450, BUT if you're in town then, email me, and I'll buy you a ton of beer at the after party!

On Tue, Dec 8, 2009 at 12:53 PM, Nick Joyce <[hidden email]> wrote:
No, calls for speakers ended 1st Oct, but I believe that the lightning talks are still open (5 mins on whatever subject you want)


On 8 Dec 2009, at 17:43, Jesse Warden wrote:

They still accepting speakers?

On Tue, Dec 8, 2009 at 12:40 PM, Nick Joyce <[hidden email]> wrote:
On 5 Dec 2009, at 06:24, Joel Hooks wrote:

> On Dec 1, 2009, at 2:04 PM, Jesse Warden wrote:
>
>> If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.
>
> Just to clarify here, I use an older version of PyAMF and Django because of the way my client side is configured in relation to the Django ORM. In the rewrite I am currently building it is using the bleeding edge PyAMF with strongly typed complex nested objects. I'm ditching Django, because I wanted something lighter weight that was easier to run/test (TDD ftw!), but if I was rebuilding it with Django, I'd still take advantage of the ORM - it just wasn't available when I started my app.
>
> My gripe is generally related to the client side lacking a persistence layer. This is a problem with ANY AMF remoting(or remoting in general, even with POPOs/POASOs). Adobe has done a really nice job writing the client side persistence bits with LCDS, and projects like DPHibernate and GraniteDS have solutions. AMFast has some support for this, but the client side is rigid and flimsy (yes, all at the same time). One of my goals for the first few months of next year is to really sit down and engineer a proper client side persistence library for PyAMF. The only thing I know for sure is I won't be calling objects fucking beans ;)

If its possible, could you detail exactly what problem the client side lib is meant to solve and how PyAMF fits in? I am a server bod and am having a big brainfart on the issue .. example code is probably easiest for me to grok, if it's easier to point me to a blog/tut.

BTW, Is anyone planning on heading to PyCon next year? Its in Atlanta Georgia @ Feb 19-21. I am 95% sure I am going this year (first time!) and would love to meet up with fellow Python/Fl[ash|ex] users. Just working out the finer travelling details ...

Cheers,

Nick
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users



_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Joel Hooks-2
On Dec 8, 2009, at 9:59 AM, Jesse Warden wrote:

> Shit.  Well, I'm not paying $450, BUT if you're in town then, email me, and I'll buy you a ton of beer at the after party!

I may cruise out and partake in the ton of beer after party.

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Joel Hooks-2
In reply to this post by Nick Joyce
On Dec 8, 2009, at 9:40 AM, Nick Joyce wrote:

> If its possible, could you detail exactly what problem the client side lib is meant to solve and how PyAMF fits in? I am a server bod and am having a big brainfart on the issue .. example code is probably easiest for me to grok, if it's easier to point me to a blog/tut.

Ok, we are dealing with object graphs with ORM, right. So I have a model like:

store
--orders

user
--store

order
--store
--user
--products

User logs in, the client receives a User object. Client retrieves orders for the User, each Order has a user and many products. Currently the Order returns a newly serialized User object. This client side lib be a mechanism for intercepting the service calls. It would ensure that one and only one instance of any unique object will live in memory on the client at a given time.

Shouldn't be too tough, really. I'd point you to code (DPHibernate does this) but I actually think it tends to be overcomplicated.

client:
http://code.google.com/p/dphibernate/source/browse/#svn/trunk/flexLibrary/flex-src/net/digitalprimates/persistence/hibernate

server:
http://code.google.com/p/dphibernate/source/browse/trunk/hibernateAdapter/src/net/digitalprimates/persistence/hibernate/proxy/HibernateProxy.java

The SQLAlchemy adapter already carries the properties that I need to do the persistence,  it is what is being used for the AMFast impl.
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Jesse Warden-2
In reply to this post by Joel Hooks-2
More the merrier.

On Wed, Dec 9, 2009 at 12:16 AM, Joel Hooks <[hidden email]> wrote:
On Dec 8, 2009, at 9:59 AM, Jesse Warden wrote:

> Shit.  Well, I'm not paying $450, BUT if you're in town then, email me, and I'll buy you a ton of beer at the after party!

I may cruise out and partake in the ton of beer after party.

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Nick Joyce
In reply to this post by Jesse Warden-2
Woo! Sounds like fun! :)

On 8 Dec 2009, at 17:59, Jesse Warden wrote:

Shit.  Well, I'm not paying $450, BUT if you're in town then, email me, and I'll buy you a ton of beer at the after party!

On Tue, Dec 8, 2009 at 12:53 PM, Nick Joyce <[hidden email]> wrote:
No, calls for speakers ended 1st Oct, but I believe that the lightning talks are still open (5 mins on whatever subject you want)


On 8 Dec 2009, at 17:43, Jesse Warden wrote:

They still accepting speakers?

On Tue, Dec 8, 2009 at 12:40 PM, Nick Joyce <[hidden email]> wrote:
On 5 Dec 2009, at 06:24, Joel Hooks wrote:

> On Dec 1, 2009, at 2:04 PM, Jesse Warden wrote:
>
>> If I did it again, I'd try to figure it out; Joel Hooks said he was actually using an older branch that ensured Django Models parsed correctly.  I'm sure it works great, and my errors were just user/developer error on my part.  Problem is, my deadlines don't care.
>
> Just to clarify here, I use an older version of PyAMF and Django because of the way my client side is configured in relation to the Django ORM. In the rewrite I am currently building it is using the bleeding edge PyAMF with strongly typed complex nested objects. I'm ditching Django, because I wanted something lighter weight that was easier to run/test (TDD ftw!), but if I was rebuilding it with Django, I'd still take advantage of the ORM - it just wasn't available when I started my app.
>
> My gripe is generally related to the client side lacking a persistence layer. This is a problem with ANY AMF remoting(or remoting in general, even with POPOs/POASOs). Adobe has done a really nice job writing the client side persistence bits with LCDS, and projects like DPHibernate and GraniteDS have solutions. AMFast has some support for this, but the client side is rigid and flimsy (yes, all at the same time). One of my goals for the first few months of next year is to really sit down and engineer a proper client side persistence library for PyAMF. The only thing I know for sure is I won't be calling objects fucking beans ;)

If its possible, could you detail exactly what problem the client side lib is meant to solve and how PyAMF fits in? I am a server bod and am having a big brainfart on the issue .. example code is probably easiest for me to grok, if it's easier to point me to a blog/tut.

BTW, Is anyone planning on heading to PyCon next year? Its in Atlanta Georgia @ Feb 19-21. I am 95% sure I am going this year (first time!) and would love to meet up with fellow Python/Fl[ash|ex] users. Just working out the finer travelling details ...

Cheers,

Nick
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Nick Joyce
In reply to this post by Joel Hooks-2
On 9 Dec 2009, at 05:38, Joel Hooks wrote:

> On Dec 8, 2009, at 9:40 AM, Nick Joyce wrote:
>
>> If its possible, could you detail exactly what problem the client side lib is meant to solve and how PyAMF fits in? I am a server bod and am having a big brainfart on the issue .. example code is probably easiest for me to grok, if it's easier to point me to a blog/tut.
>
> Ok, we are dealing with object graphs with ORM, right. So I have a model like:
>
> store
> --orders
>
> user
> --store
>
> order
> --store
> --user
> --products
>
> User logs in, the client receives a User object. Client retrieves orders for the User, each Order has a user and many products. Currently the Order returns a newly serialized User object. This client side lib be a mechanism for intercepting the service calls. It would ensure that one and only one instance of any unique object will live in memory on the client at a given time.
>
> Shouldn't be too tough, really. I'd point you to code (DPHibernate does this) but I actually think it tends to be overcomplicated.

Right, that makes more sense now, thanks!

Sounds similar to RTMP SharedObjects. Presumably the scope of communication is limited to the the session between the client and server? For example, client1 gets a store object (store1 for claritly sake). client2 adds an order to store1 and store1.orders gets updated server side. client1 get notified about the change or only when/if it refetches store1?

>
> client:
> http://code.google.com/p/dphibernate/source/browse/#svn/trunk/flexLibrary/flex-src/net/digitalprimates/persistence/hibernate
>
> server:
> http://code.google.com/p/dphibernate/source/browse/trunk/hibernateAdapter/src/net/digitalprimates/persistence/hibernate/proxy/HibernateProxy.java

Great, these helped a lot.

>
> The SQLAlchemy adapter already carries the properties that I need to do the persistence,  it is what is being used for the AMFast impl.

I have been wondering for a while why sa_key/sa_lazy were being added to SA objects, with no obvious benefit ... The only PyAMF adapter that doesn't have support this right now is Django but adding the 'pk' attribute would be pretty simple.

Some quick questions:

- Could the client be flexible enough to handle different ORM schemes .. e.g. GAE objects have the _key attribute as the 'primary key', SA/sa_key, Django/pk. Each 'id' attribute is named depending on the underlying ORM, so changing those might be tricksy ...
- Would lazy attribute loading be able to be handled?
- Would the lib interoperate easily with Flex Messaging (might be a dumb question - I don't know :)?

Depending on the scope of the lib, feature set and required updates to PyAMF this might be a Plasma feature (and an awesome one at that). I am wary of expanding PyAMF too much because it was always meant as a Python lib to handle low level AMF operations. Pragmatism wins, however!

Cheers,

Nick
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Send data from flex to django

Joel Hooks-2
On Dec 9, 2009, at 8:59 AM, Nick Joyce wrote:

> Sounds similar to RTMP SharedObjects. Presumably the scope of communication is limited to the the session between the client and server? For example, client1 gets a store object (store1 for claritly sake). client2 adds an order to store1 and store1.orders gets updated server side. client1 get notified about the change or only when/if it refetches store1?

That might be something down the road, but for right now I just want to make sure that objects on client1 are the same instance. Across clients would be phase2. :>
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users