Is it possible to define a function without reference to selfthis?
def myfunc(var_a,var_b)
But so that he can also get the sender data, for example, if I defined it like this:
def myfunc(self, var_a,var_b)
What selfis always the same, so there is always a little over-run this function: myfunc(self,'data_a','data_b'). Then I would like to get its data in a function like this sender.fields.
UPDATE:
Here is some code to better understand what I mean. The following class is used to display a page based on the Jinja2 template engine for subscribers.
class SignupHandler(webapp.RequestHandler):
def get(self, *args, **kwargs):
utils.render_template(self, 'signup.html')
And this code below render_template, which I created as a wrapper for Jinja2 functions, to use it more conveniently in my project:
def render_template(response, template_name, vars=dict(), is_string=False):
template_dirs = [os.path.join(root(), 'templates')]
logging.info(template_dirs[0])
env = Environment(loader=FileSystemLoader(template_dirs))
try:
template = env.get_template(template_name)
except TemplateNotFound:
raise TemplateNotFound(template_name)
content = template.render(vars)
if is_string:
return content
else:
response.response.out.write(content)
render_template , , , , , , , self , .