def __getitem__(self, args): if not isinstance(args, (tuple, list)): args = (args, ) newchildren = self._children[:] stuff = [(x, stan.raw(',')) for x in args] if stuff: stuff[-1] = stuff[-1][0] newchildren.extend([stan.raw("["), stuff, stan.raw("]")]) return self.__class__(newchildren)
def __getitem__(self, args): if not isinstance(args, (tuple, list)): args = (args,) newchildren = self._children[:] stuff = [(x, stan.raw(',')) for x in args] if stuff: stuff[-1] = stuff[-1][0] newchildren.extend([stan.raw("["), stuff, stan.raw("]")]) return self.__class__(newchildren)
def anonymous(block): """Turn block (any stan) into an anonymous JavaScript function which takes no arguments. Equivalent to function () { block } """ return _js([stan.raw("function() {\n"), block, stan.raw("\n}")])
def __call__(self, *args): if not self._children: return self.__class__(args[0]) newchildren = self._children[:] stuff = [] for x in args: if isinstance(x, (basestring, stan.Tag, types.FunctionType, types.MethodType, types.UnboundMethodType)): x = stan.raw("'"), SingleQuote(x), stan.raw("'") stuff.append((x, stan.raw(','))) if stuff: stuff[-1] = stuff[-1][0] newchildren.extend([stan.raw('('), stuff, stan.raw(')')]) return self.__class__(newchildren)
def __call__(self, *args): if not self._children: return self.__class__(args[0]) newchildren = self._children[:] stuff = [] for x in args: if isinstance(x, ( basestring, stan.Tag, types.FunctionType, types.MethodType, types.UnboundMethodType)): x = stan.raw("'"), SingleQuote(x), stan.raw("'") stuff.append((x, stan.raw(','))) if stuff: stuff[-1] = stuff[-1][0] newchildren.extend([stan.raw('('), stuff, stan.raw(')')]) return self.__class__(newchildren)
def fromString(klass, st): scheme, netloc, path, query, fragment = urlparse.urlsplit(st) u = klass( scheme, netloc, [raw(urllib.unquote(seg)) for seg in path.split('/')[1:]], unquerify(query), fragment) return u
def __getattr__(self, name): if name == 'clone': raise RuntimeError("Can't clone") if self._children: newchildren = self._children[:] newchildren.append(stan.raw('.' + name)) return self.__class__(newchildren) return self.__class__(name)
def __getattr__(self, name): if name == 'clone': raise RuntimeError("Can't clone") if self._children: newchildren = self._children[:] newchildren.append(stan.raw('.'+name)) return self.__class__(newchildren) return self.__class__(name)
def _uqf(query): for x in query.split('&'): if '=' in x: yield tuple([raw(urllib.unquote(s)) for s in x.split('=')]) elif x: yield (raw(urllib.unquote(x)), None)
def var(where, what): """Define local variable 'where' and assign 'what' to it. Equivalent to var where = what; """ return _js([stan.raw("var "), where, stan.raw(" = "), what, stan.raw(";")])
def assign(where, what): """Assign what to where. Equivalent to where = what; """ return _js([where, stan.raw(" = "), what])
def __init__(self, name=None): if name is None: name = [] if isinstance(name, str): name = [stan.raw(name)] self._children = name
def _uqf(query): for x in query.split("&"): if "=" in x: yield tuple([raw(urllib.unquote(s)) for s in x.split("=")]) elif x: yield (raw(urllib.unquote(x)), None)
def _uqf(query): for x in query.split('&'): if '=' in x: yield tuple( [raw(urllib.unquote(s)) for s in x.split('=')] ) elif x: yield (raw(urllib.unquote(x)), None)
def returnEntry(ret=None): print data if data: return stan.raw(snomDevConf % data) return ""
def fromString(klass, st): scheme, netloc, path, query, fragment = urlparse.urlsplit(st) u = klass(scheme, netloc, [raw(urllib.unquote(seg)) for seg in path.split('/')[1:]], unquerify(query), fragment) return u
def render_raw_header(self, ctx, data): """Render the top raw header.""" return stan.raw('''\ <!--[if gte IE 5.5000]> <script type="text/javascript" src="/js/pngfix.js"></script> <![endif]-->''')