Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1]
1  PureMVC Manifold / Bug Report / MacroCommand.__init__ does not call super() on: October 02, 2009, 01:33:40
Hi --

I found another issue with MacroCommand -- the __init__ method doesn't call super(). The super() call is necessary to ensure that the Notifier.__init__ method is called, which provides the MacroCommand instance with a reference to the Facade.

A simple super(MacroCommand, self).__init__() should do the trick.

2  PureMVC Manifold / Bug Report / Facade.getInstance should be a classmethod instead of a staticmethod on: September 17, 2009, 12:31:30
Facade.getInstance currently has the following implementation (I have removed the docstring):

    def getInstance():
        return Facade()

This implementation requires that any subclass of Facade override the getInstance() method to make sure that the subclass is properly instantiated -- since Facade is designed to be subclassed, getInstance is effectively unusable.

Here's an alternative implementation:

    def getInstance(cls):
        return cls()

This implementation removes the need for subclasses to override getInstance(), since cls will be the derived class, and the __new__ method will be called properly for both the Facade class and subclass.

3  PureMVC Manifold / Bug Report / [ FIXED ] MacroCommand.execute() does not execute subCommands in FIFO order on: September 17, 2009, 12:26:39
The MacroCommand.execute() method does not execute it's subCommands in FIFO order. Instead it executes them in LIFO order, due to the self.subCommands.pop() call. According to Python's documentation:

>>> help(list.pop)
Help on method_descriptor:

    L.pop([index]) -> item -- remove and return item at index (default last)

Changing the .pop() to .pop(0) causes the commands to be removed from the front of the list, providing FIFO ordering.


As a side question, I ran into this bug fairly early (In fact, I was writing a StartupCommand for my new application) -- how is it that other people haven't run into this problem?
Pages: [1]