Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In order to support this, PyAMF needs to provide a synonym mapping between fields. Until then, you could use <a href="http://livedocs.adobe.com/flex/3/langref/flash/utils/IExternalizable.html" rel="nofollow noreferrer">IExternalizable</a> (although clumsily):</p> <pre><code>class UserProfile(model.Model): user = models.ForeignKey( User, unique=True ) blurb = models.CharField( max_length=200, null=True, blank=True ) public = models.BooleanField( default=True ) class __amf__: external = True def __writeamf__(self, output): output.writeObject(self.id) output.writeObject(self.blurb) output.writeObject(self.public) def __readamf__(self, input): self.id = input.readObject() self.blurb = input.readObject() self.public = input.readObject() </code></pre> <p>With the corresponding Flex code:</p> <pre><code>[RemoteClass(alias="...")] [Bindable] public class UserProfile implements IExternalizable { public function UserProfile() { } public var id:int; public var blurb:String; public var _public:Boolean; public function writeExternal(output:IDataOutput) { output.writeObject(id); output.writeObject(blurb); output.writeObject(_public); } public function readExternal(input:IDataInput) { id = input.readObject(); blurb = input.readObject(); _public = input.readObject(); } } </code></pre> <p>Note I haven't tested the above code, but should work in principle.</p> <p>Btw, can you go into greater detail about what was confusing about the <a href="http://docs.pyamf.org/architecture/attributecontrol.html" rel="nofollow noreferrer">documentation</a>? I would love to make that as clear possible for new users.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COawesome, thank you so much, i'm sure this should work, i'll try it out shortly. to be fair, i did see something to this effect written someplace, i was just hoping that there would be something more explicit that would write this for me, so that i wouldn't have to keep doing it in the future. however, i guess i could write the wrapper for this and post it for others to use. :-) to answer your request, i'd say that giving what you wrote above as an example in the documentation link you pointed to would have helped - i had to dig elsewhere to get something similar to the above.
      singulars
    2. COalso, the above has the flavor of being a bit of a hack, or skirting under the hood, to me. it doesn't give me confidence that it's not going to break something elsewhere. whereas a specific api that maps one field to another would. however, that's just the feeling i get from typing so many __ double-underscore __ things that include hard-coded-ordered information. (feels like packing tcp by hand or something :-) it would also be nice if there were more of an explanation of the classalias interface. i'm not really sure what it does, after having read the documentation, or how to use it.
      singulars
    3. COClassAlias is meant to be an internal class to PyAMF that is used to process the metadata that [class].__amf__ provides. The above answer is indeed a hack and I have created a ticket provide the synonym facility described. See http://dev.pyamf.org/ticket/779
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload