def _getBrowserCharset(self): return getBrowserCharset(self.request)
##parameters=provider, action_path, **kw ## from ZTUtils import make_query from Products.CMFCore.utils import getToolByName from Products.CMFDefault.utils import getBrowserCharset utool = getToolByName(script, 'portal_url') portal_url = utool() try: target = provider.getActionInfo(action_path)['url'] except ValueError: target = portal_url message = context.REQUEST.other.get('portal_status_message', '') if message: if isinstance(message, unicode): message = unicode(message).encode(getBrowserCharset(context.REQUEST)) kw['portal_status_message'] = message for k, v in kw.items(): if not v: del kw[k] query = kw and ( '?%s' % make_query(kw) ) or '' context.REQUEST.RESPONSE.redirect( '%s%s' % (target, query) ) return True
##parameters=provider, action_path, **kw ## from ZTUtils import make_query from Products.CMFCore.utils import getToolByInterfaceName from Products.CMFDefault.utils import getBrowserCharset utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool') portal_url = utool() try: target = provider.getActionInfo(action_path)['url'] except ValueError: target = portal_url message = context.REQUEST.other.get('portal_status_message', '') if message: if isinstance(message, unicode): message = unicode(message).encode(getBrowserCharset(context.REQUEST)) kw['portal_status_message'] = message for k, v in kw.items(): if not v: del kw[k] query = kw and ('?%s' % make_query(kw)) or '' context.REQUEST.RESPONSE.redirect('%s%s' % (target, query)) return True
portal_object = utool.getPortalObject() isAnon = mtool.isAnonymousUser() member = mtool.getAuthenticatedMember() if not 'charset' in (context.REQUEST.RESPONSE.getHeader('content-type') or ''): # Some newstyle views set a different charset - don't override it. # Oldstyle views need the default_charset. default_charset = ptool.getProperty('default_charset', None) if default_charset: context.REQUEST.RESPONSE.setHeader('content-type', 'text/html; charset=%s' % default_charset) message = context.REQUEST.get('portal_status_message') if message and isinstance(message, str): # portal_status_message uses always the browser charset. message = message.decode(getBrowserCharset(context.REQUEST)) globals = {'utool': utool, 'mtool': mtool, 'atool': atool, 'wtool': wtool, 'syndtool': syndtool, 'caltool_installed': caltool is not None, 'uidtool_installed': uidtool is not None, 'portal_object': portal_object, 'portal_title': portal_object.Title(), 'object_title': context.Title(), 'object_description': context.Description(), 'portal_url': utool(), 'member': member, 'membername': isAnon and 'Guest' or (member.getProperty('fullname')
portal_object = utool.getPortalObject() isAnon = mtool.isAnonymousUser() member = mtool.getAuthenticatedMember() if not 'charset' in (context.REQUEST.RESPONSE.getHeader('content-type') or ''): # Some newstyle views set a different charset - don't override it. # Oldstyle views need the default_charset. default_charset = ptool.getProperty('default_charset', None) if default_charset: context.REQUEST.RESPONSE.setHeader( 'content-type', 'text/html; charset=%s' % default_charset) message = context.REQUEST.get('portal_status_message') if message and isinstance(message, str): # portal_status_message uses always the browser charset. message = message.decode(getBrowserCharset(context.REQUEST)) globals = { 'utool': utool, 'mtool': mtool, 'atool': atool, 'wtool': wtool, 'syndtool': syndtool, 'caltool_installed': caltool is not None, 'uidtool_installed':