1. Shu Zong Chen
  2. django-contact-forms


Shu Zong Chen  committed e1c1744

callbacks now have access to the request

  • Participants
  • Parent commits 8dd29df
  • Branches default

Comments (0)

Files changed (2)

File contactforms/callbacks.py

View file
 	Creates a callback function that sends an email.
 	tmpls = dict((k, Template(v)) for k,v in kwargs.iteritems())
-	def cb(ctx):
+	def cb(request, ctx):
 		c = Context(ctx)
 			subject = tmpls['subject'].render(c)
 	Create a callback to encapsulate multiple other callbacks.
 	cbs = args
-	def cb(ctx):
+	def cb(request, ctx):
 		for _cb in cbs:
-			_cb(ctx)
+			_cb(request, ctx)
 	return cb

File contactforms/models.py

View file
 		if cb is not None and self.request.method == 'POST':
 			if self.form.is_valid():
 				data = self.form.cleaned_data
-				cb(data)
+				cb(self.request, data)
 				self.success = True
 	def render_widget(self):