So far, I’ve had great success using PyAMF to communicate between my Flex front-end and my Django back-end. However, I believe I’ve encountered a bug. The following example (emphasis on the word ‘example’) demonstrates the (potential) bug:
My Flex app contains the following VO:
package myproject.model.vo { [Bindable] [RemoteClass(alias='myproject.models.Book')] public class BookVO { public var id:int; public var title:String; public var numberOfOddPages:int; } }
My Django app contains the following model:
class Book(models.Models): title = models.CharField(max_length=20) def _get_number_of_odd_pages(self): #some code that calculates odd pages return odd_page_total numberOfOddPages = property(_get_number_of_odd_pages)
When I attempt to retrieve the book objects to display in a DataGrid, the books display in the grid as expected. However, ‘numberOfOddPages’ is always set to 0. I have even attempted to explicitly set this attribute with a default value (i.e., ‘numberOfOddPages=100’) to see if my ‘_get_number_of_odd_pages()’ method had an error in it. Unfortunately, it yields the same result: the value in the VO remains at 0.
Does anyone have any insight into what I may be doing wrong?
I just received the following response from PyAMF’s lead developer. It’s definitely a bug:
UPDATE: Nick has fixed this bug and it will be released in PyAMF 0.4.1 (which should be released this weekend).