public class JythonHashModel extends JythonModel implements TemplateHashModelEx
PyDictionary
and PyStringMap).
Note that the basic JythonModel already provides access to the
PyObject.__finditem__(String) method. This class only adds
TemplateHashModelEx functionality in a somewhat skewed way. One
could say it even violates TemplateHashModelEx semantics, as both the
returned keys and values are only those from the item mapping, while the
get() method works for attributes as well. However, in practice
when you ask for dict?keys inside a template, you'll really
want to retrieve only items, not attributes so this is considered OK.object, wrapperNOTHINGFALSE, TRUEEMPTY_STRING| Constructor and Description |
|---|
JythonHashModel(org.python.core.PyObject object,
JythonWrapper wrapper) |
| Modifier and Type | Method and Description |
|---|---|
TemplateCollectionModel |
keys()
Returns either
object. |
int |
size()
Returns
PyObject.__len__(). |
TemplateCollectionModel |
values()
Returns
object. |
exec, get, getAdaptedObject, getAsBoolean, getAsString, getWrappedObject, isEmptyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, isEmptypublic JythonHashModel(org.python.core.PyObject object,
JythonWrapper wrapper)
public int size()
throws TemplateModelException
PyObject.__len__().size in interface TemplateHashModelExTemplateModelExceptionpublic TemplateCollectionModel keys() throws TemplateModelException
object.__findattr__("keys").__call__()
or object.__findattr__("keySet").__call__().keys in interface TemplateHashModelExTemplateScalarModel
(as the keys of hashes are always strings).TemplateModelExceptionpublic TemplateCollectionModel values() throws TemplateModelException
object.__findattr__("values").__call__().values in interface TemplateHashModelExTemplateModel-s.TemplateModelException