Re: users Digest, Vol 27, Issue 5

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: users Digest, Vol 27, Issue 5

Martin Andersen-2
Hi David

I know this is an old follow up, but I simply haven't had the time to look at it.

Your proposal doesn't seem to work, I get the following error:

File "/home/pythonPackages/django-1.2-759/pyamf/__init__.py", line 1104, in getTypeFunc
    raise EncodeError("Cannot encode %r" % (data,))
EncodeError: Cannot encode <function _curried at 0x1551c08>

Also the way I read the documentation, static is for checking if a property are on a object who are about to be decoded?

Regards
Martin
 
Message: 1
Date: Wed, 10 Feb 2010 08:40:29 -0500
From: David Wolever <[hidden email]>
Subject: Re: [pyamf-users] Getting the object tree,     via PyAMF from
       Django backend.
To: PyAMF general discussion <[hidden email]>
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="us-ascii"

I believe you're looking for the 'static' attribute on the __amf__
class. Eg:

class A:
    name = CharField()
    class __amf__:
        static = ('set_of_cs', )

class B:
    name = CharField()
    class __amf__:
        static = ('set_of_cs', )

class C:
    a = ForeignKey(A, related_name="set_of_cs")
    b = ForeignKey(B, related_name="set_of_cs")

Does that help?

On 10-Feb-10, at 5:57 AM, Martin Andersen wrote:

> Hi
>
> I currently developing a Flex app which users PyAMF to communicate
> with a Django backend.
>
> But I'm having some problems, I got 2 objects, which shares a common
> object, I have implemented this in Flex, with the 2 objects each
> having an array of references to the 3. object.
> But because Django models a modeled with references as foreignkeys,
> the structure is upside down, The 3. object, has 2 properties, that
> holds references to the first 2.
>
> My initial idea was first, to just pull firstObject.objects.all(),
> and later secondObject.objects.all(), but the problem is ofcourse
> that they don't pick up the references in the Flex app. So my
> thought were to pull the object tree correctly, by doing a property
> "trick".
> But I can't seem to get it to work, and I don't know if it can either.
>
> http://pastebin.com/f47a78938
>
> But have any of you had similar usecases, if so, how have you solved
> them?
>
> Regards
> Martin
> _______________________________________________
> 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