Skip to content

Instantly share code, notes, and snippets.

@cloverrose
Last active December 14, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloverrose/e9ce31fc9ec1e9350d4d to your computer and use it in GitHub Desktop.
Save cloverrose/e9ce31fc9ec1e9350d4d to your computer and use it in GitHub Desktop.
# django/template/defaulttags.py
# modify to check sequence object
print 'sequesce', sequence, type(sequence)
print '-' * 100
for i in dir(sequence):
print i, sequence.__getattribute__(i)
print '+' * 100
print '*' * 100
print 'type(sequence.var)', type(sequence.var)
print '/' * 100
# and debug resulet
sequesce points_3d <class 'django.template.base.FilterExpression'>
----------------------------------------------------------------------------------------------------
__class__ <class 'django.template.base.FilterExpression'>
__delattr__ <method-wrapper '__delattr__' of FilterExpression object at 0x10dea0210>
__dict__ {'var': <Variable: u'points_3d'>, 'token': u'points_3d', 'filters': []}
__doc__
Parses a variable token and its optional filters (all as a single string),
and return a list of tuples of the filter name and arguments.
Sample::
>>> token = 'variable|default:"Default value"|date:"Y-m-d"'
>>> p = Parser('')
>>> fe = FilterExpression(token, p)
>>> len(fe.filters)
2
>>> fe.var
<Variable: 'variable'>
This class should never be instantiated outside of the
get_filters_from_token helper function.
__format__ <built-in method __format__ of FilterExpression object at 0x10dea0210>
__getattribute__ <method-wrapper '__getattribute__' of FilterExpression object at 0x10dea0210>
__hash__ <method-wrapper '__hash__' of FilterExpression object at 0x10dea0210>
__init__ <bound method FilterExpression.__init__ of <django.template.base.FilterExpression object at 0x10dea0210>>
__module__ django.template.base
__new__ <built-in method __new__ of type object at 0x10c55adc0>
__reduce__ <built-in method __reduce__ of FilterExpression object at 0x10dea0210>
__reduce_ex__ <built-in method __reduce_ex__ of FilterExpression object at 0x10dea0210>
__repr__ <method-wrapper '__repr__' of FilterExpression object at 0x10dea0210>
__setattr__ <method-wrapper '__setattr__' of FilterExpression object at 0x10dea0210>
__sizeof__ <built-in method __sizeof__ of FilterExpression object at 0x10dea0210>
__str__ <bound method FilterExpression.__str__ of <django.template.base.FilterExpression object at 0x10dea0210>>
__subclasshook__ <built-in method __subclasshook__ of type object at 0x7ff8ec08a350>
__weakref__ None
args_check <function args_check at 0x10d1b6578>
filters []
resolve <bound method FilterExpression.resolve of <django.template.base.FilterExpression object at 0x10dea0210>>
token points_3d
var points_3d
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
****************************************************************************************************
type(sequence.var) <class 'django.template.base.Variable'>
////////////////////////////////////////////////////////////////////////////////////////////////////
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment