`self` variable is not defined
See original GitHub issueHi,
The following code triggers an error (), is it normal ? It works fine in jinja :
{% block test %}{% endblock %}
{{ self.test() }}
(self.test()
should return the content of the test
block, especially useful when you want to wrap contents such as in the following example)
{% if self.test() | trim != "" %}
<div class="wrapper">
{% block test %}{% endblock %}
</div>
{% endif %}
Issue Analytics
- State:
- Created 10 years ago
- Reactions:17
- Comments:15
Top Results From Across the Web
python global name 'self' is not defined - Stack Overflow
self is the self-reference in a Class. Your code is not in a class, you only have functions defined. You have to wrap...
Read more >NameError: name 'self' is not defined in Python [Solved]
To solve the NameError: name 'self' is not defined, make sure you haven't forgotten to specify the `self` argument in a method and...
Read more >Python NameError: name 'self' is not defined - Softhints
Common errors for beginners related to self in Python is: NameError: name 'self' is not defined The keyword self is a special one...
Read more >self is not defined? (Example) | Treehouse Community
So to answer your question. Self is not defined because the init method doesn't start with self. And your n value also has...
Read more >python: self.variable within function [closed]
Should those k , y , and z be defined as __init__ . variables or not? What should be the difference between the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My workaround is in the place where the block’s content wants to be used multiple times.
Instead of
I am doing
this makes
pageTitlePrefix
also a variable and that can be used any number of times. As long as theself.*
thingy does not exist I am quite happy with this. Maybe worth mentioning in the docs.any update?