Exemple #1
0
 def check_content_type(self, text, expected_type):
     f = open(self.TEMPFILENAME, "wb")
     f.write(text)
     f.close()
     pt = PageTemplateFile(self.TEMPFILENAME)
     pt.read()
     self.assertEqual(pt.content_type, expected_type)
Exemple #2
0
 def check_content_type(self, text, expected_type):
     f = open(self.TEMPFILENAME, "wb")
     f.write(text)
     f.close()
     pt = PageTemplateFile(self.TEMPFILENAME)
     pt.read()
     self.assertEqual(pt.content_type, expected_type)
Exemple #3
0
 def check_content_type(self, bytes, expected_type, encoding=None):
     with open(self.TEMPFILENAME, "wb") as f:
         f.write(bytes)
     if encoding:
         pt = PageTemplateFile(self.TEMPFILENAME, encoding=encoding)
     else:
         pt = PageTemplateFile(self.TEMPFILENAME)
     pt.read()
     self.assertEqual(pt.content_type, expected_type)
Exemple #4
0
 def check_content_type(self, bytes, expected_type, encoding=None):
     with open(self.TEMPFILENAME, "wb") as f:
         f.write(bytes)
     if encoding:
         pt = PageTemplateFile(self.TEMPFILENAME, encoding=encoding)
     else:
         pt = PageTemplateFile(self.TEMPFILENAME)
     pt.read()
     self.assertEqual(pt.content_type, expected_type)
 def manage_updatePortlets(self, REQUEST=None, **kwargs):
     """Add admininstration portlet"""
     ptool = getattr(self, "portal_portlets", None)
     if not ptool:
         zLOG.LOG("NaayaSurvey", zLOG.ERROR, "Could not add administration portlet for portal_survey")
         return
     zLOG.LOG(
         "NaayaSurvey", zLOG.INFO, "Adding administration portlet to portal_portlets %s" % (ptool.absolute_url(1))
     )
     #
     # Admin portlet
     #
     portlet_id = "portlet_admin_survey"
     portlet_title = "Portal Survey Manager"
     if portlet_id not in ptool.objectIds():
         ptool.addPortlet(portlet_id, portlet_title, portlettype=100)
     portlet_ob = ptool._getOb(portlet_id)
     # Set portlet content
     text = PageTemplateFile("portlets/%s" % portlet_id, globals())
     text = text.read()
     portlet_ob.pt_edit(text=text, content_type="text/html")
     # Add special property in order to be found by generic template
     if not portlet_ob.hasProperty("show_in_form"):
         portlet_ob.manage_addProperty("show_in_form", "admin_centre_html", "string")
     portlet_ob.manage_changeProperties(show_in_form="admin_centre_html")
def manage_addRDFCalendar(self, id, title='', first_day_week='Monday',
        week_day_len=3, REQUEST=None):
    """Add a new RDFCalendar object with id=title."""

    ob=RDFCalendar(id, title, first_day_week, week_day_len)
    ob.id = id
    self._setObject(id, ob)

    #create index_html page template
    indexfile = PageTemplateFile('zpt/RDFCalendarIndex', globals())
    content = indexfile.read()
    manage_addPageTemplate(ob, id='index_html', title='Calendar Events', text=content)
    
    #create show_day_events page template
    show_events_file = PageTemplateFile('zpt/RDFCalendar_dayevents', globals())
    content = show_events_file.read()
    manage_addPageTemplate(ob, id='show_day_events', title='Show events for one day', text=content)
    
    
    if REQUEST is not None:
        return self.manage_main(self, REQUEST, update_menu=1)