示例#1
0
    def __init__(self, superclass=None, override=False):
        """Initialize the global class, e.g., by storing run-time
        arguments and by retrieving and preparing the module's
        configuration file.

        Args:
            superclass: Full name of the global class's superclass,
                        e.g., "Mage_Rss_Block_Abstract".
            override: Whether this global class should override its
                      superclass.

        """
        Class.__init__(self)
        self.superclass = self._infer_super(superclass)
        self.override = override
        self.type_tag = self.type + "s"
        self.config = self.get_config()
        self._prepare_config()
        self.xpath = "/config/global/" + self.type_tag
        self.type_elem = self.config.xpath(self.xpath)[0]
示例#2
0
    def __init__(self, front_name=None, override=False, superclass=None,
                 router=None):
        """Initialize the controller, e.g., by storing run-time arguments.

        Args:
            front_name: The string to use as the module's
                        frontName. By convention this string
                        is the module's name, lower-cased.
            override: Whether the module's controller(s) should
                      override the controller(s) of the module
                      to which its superclass belongs.
            superclass: Full name of the controller's superclass,
                        e.g., "Mage_Adminhtml_Controller_Action".
            router: Name of the front controller router to use.
                    Available routers are "standard", "admin", and
                    "default".

        """
        Class.__init__(self)
        self.front_name = front_name or self.module.name.lower()
        self.override = override
        self.superclass = superclass or "Mage_Core_Controller_Front_Action"
        self.router = router or "standard"