def test_unfiltered(self):
     """ Test unfiltered template input. 
     
     See that unfiltered code is succesfully evaluated if present.
     """
     
     # this is a test case for django
     engine.setDefaultEngine()        
     self.createContent()
     self.portal.folder.easy_template.setText("Foobar")
     self.portal.folder.easy_template.setUnfilteredTemplate("{{ explore(context) }}")
     output = self.portal.folder.easy_template.getTemplatedText()
     
     messages = IStatusMessage(self.portal.REQUEST).showStatusMessages()                
     for m in messages: print str(m.message)
     
     self.assertEqual(len(messages), 0)
             
     # Should have variables dumped         
     self.assertTrue("easy_template" in output)
    def test_unfiltered(self):
        """ Test unfiltered template input. 
        
        See that unfiltered code is succesfully evaluated if present.
        """

        # this is a test case for django
        engine.setDefaultEngine()
        self.createContent()
        self.portal.folder.easy_template.setText("Foobar")
        self.portal.folder.easy_template.setUnfilteredTemplate(
            "{{ explore(context) }}")
        output = self.portal.folder.easy_template.getTemplatedText()

        messages = IStatusMessage(self.portal.REQUEST).showStatusMessages()
        for m in messages:
            print str(m.message)

        self.assertEqual(len(messages), 0)

        # Should have variables dumped
        self.assertTrue("easy_template" in output)
 def afterSetUp(self):
     # Might be another engine since some tests switch
     # this global variable
     engine.setDefaultEngine()
        request = mappings['request']
        view = getMultiAdapter((context, request), name="deals_tag")
        return view()
    
class DealsTagView(grok.View):
    """
    Define a view which is called thru script tag, with special parameters 
    set up by the tag class.
    """
    
    grok.name("deals_tag")        
    grok.template("deals_tag")    
    
    def getItems(self):
        """
        Get X amount of nested item from folder hierarchy by portal type, sorted by creation.
        """        
    
        kwargs = {}
        kwargs["max"] = {"deals.mocality.co.ke" : 1, "www.zetu.co.ke":1, "manual":2}
        from frontpage import get_deals
        items = get_deals(self.context, self.request, **kwargs)
        return items    
    
    def getMasterItem(self):
        return self.context.portal_url.getPortalObject()["deals-discounts"]
        

tag_list += [FrontPageBlockTag(), LatestPickTag(), DealsTag()]
setDefaultEngine() # Refresh tag list