def evalexprs(self, name, text, filters, globals_, locals_): """Evaluate expression ``text`` in ``globals_`` and ``locals_`` context using plugin prefix in ``text`` or using the TTLCompiler['expression.default'] plugin. Convert the resulting object to string, pipe them to the list of filters specified by ``filters``. ``filters`` is comma separated value of escape filters to be applied on the output string. """ exprp = self.exprplugins['expression' + name] if name else self.exprdefault out = exprp.eval(self, text, globals_, locals_) if not filters: return out filters = h.parsecsv(filters) if 'n' in filters: return out # TODO : if exprdefault and exprp are same plugin, we might end up # calling it twice. Try to improve the performance. for f in filters: out1 = exprp.filter(self, f, out) if out1 == None: out1 = self.exprdefault.filter(self, f, out) if out1 != None: out = out1 break return out
def evalexprs( self, name, text, filters, globals_, locals_ ) : """Evaluate expression ``text`` in ``globals_`` and ``locals_`` context using plugin prefix in ``text`` or using the TTLCompiler['expression.default'] plugin. Convert the resulting object to string, pipe them to the list of filters specified by ``filters``. ``filters`` is comma separated value of escape filters to be applied on the output string. """ exprp=self.exprplugins['expression'+name] if name else self.exprdefault out = exprp.eval( self, text, globals_, locals_ ) if not filters : return out filters = h.parsecsv( filters ) if 'n' in filters : return out # TODO : if exprdefault and exprp are same plugin, we might end up # calling it twice. Try to improve the performance. for f in filters : out1 = exprp.filter( self, f, out ) if out1 == None : out1 = self.exprdefault.filter( self, f, out ) if out1 != None : out = out1 break return out
def _fetch_xc(self, _xc, page) : ps = h.parsecsv( _xc ) context = {} for s in ps : p = self.plugins.get(s, None) context.update( p.fetch(page) ) if p else None return context
def normalize_settings( cls, sett ): """:meth:`pluggdapps.plugin.ISettings.normalize_settings` interface method.""" sett['nocache'] = h.asbool( sett['nocache'] ) sett['optimize'] = h.asint( sett['optimize'] ) sett['lex_debug'] = h.asint( sett['lex_debug'] ) sett['yacc_debug'] = h.asint( sett['yacc_debug'] ) sett['strict_undefined'] = h.asbool( sett['strict_undefined'] ) sett['directories'] = h.parsecsvlines( sett['directories'] ) sett['tag.plugins'] = h.parsecsvlines( sett['tag.plugins'] ) sett['beautify_html'] = h.asbool( sett['beautify_html'] ) sett['memcache'] = h.asbool( sett['memcache'] ) sett['helpers'] = h.parsecsv( sett['helpers'] ) return sett
def normalize_settings(cls, sett): """:meth:`pluggdapps.plugin.ISettings.normalize_settings` interface method.""" sett['nocache'] = h.asbool(sett['nocache']) sett['optimize'] = h.asint(sett['optimize']) sett['lex_debug'] = h.asint(sett['lex_debug']) sett['yacc_debug'] = h.asint(sett['yacc_debug']) sett['strict_undefined'] = h.asbool(sett['strict_undefined']) sett['directories'] = h.parsecsvlines(sett['directories']) sett['tag.plugins'] = h.parsecsvlines(sett['tag.plugins']) sett['beautify_html'] = h.asbool(sett['beautify_html']) sett['memcache'] = h.asbool(sett['memcache']) sett['helpers'] = h.parsecsv(sett['helpers']) return sett
def _skip_context(self, page): attrs = h.parsecsv( page.site.siteconfig.get( 'skip_context', '' )) + \ h.parsecsv( page.context.get( 'skip_context', '' )) [ page.context.update(attr=None) for attr in attrs ] return page
def normalize_pluggdapps(sett): """Normalize settings for [pluggdapps] special section.""" sett["port"] = h.asint(sett["port"]) if isinstance(sett["logging.output"], str): sett["logging.output"] = h.parsecsv(sett["logging.output"]) return sett
def normalize_pluggdapps(sett): """Normalize settings for [pluggdapps] special section.""" sett['port'] = h.asint(sett['port']) if isinstance(sett['logging.output'], str): sett['logging.output'] = h.parsecsv(sett['logging.output']) return sett