Skip to content

Commit

Permalink
Update default form rendering templates to be compatible with
Browse files Browse the repository at this point in the history
zope.formlib's CSRF protection (still on a branch).
  • Loading branch information
janwijbrand committed Oct 4, 2013
1 parent 8836b5d commit a5eda97
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion buildout.cfg
@@ -1,5 +1,7 @@
[buildout]
develop = .
develop =
.
../zope.formlib-csrfprotection
parts = interpreter test
extends = https://raw.github.com/zopefoundation/groktoolkit/master/grok.cfg
versions = versions
Expand All @@ -8,6 +10,7 @@ extensions = buildout.dumppickedversions

[versions]
grokcore.formlib =
zope.formlib =

[interpreter]
recipe = zc.recipe.egg
Expand Down
7 changes: 6 additions & 1 deletion src/grokcore/formlib/templates/default_display_form.pt
Expand Up @@ -26,7 +26,12 @@
<tfoot>
<tr class="controls">
<td colspan="2" class="align-right">
<input tal:repeat="action view/actions"
<input type="hidden"
name="___csrftoken__"
tal:condition="view/protected"
tal:attributes="value view/csrftoken"
/>
<input tal:repeat="action view/actions"
tal:replace="structure action/render" />
</td>
</tr>
Expand Down
5 changes: 5 additions & 0 deletions src/grokcore/formlib/templates/default_edit_form.pt
Expand Up @@ -57,6 +57,11 @@
</table>

<div id="actionsView">
<input type="hidden"
name="___csrftoken__"
tal:condition="view/protected"
tal:attributes="value view/csrftoken"
/>
<span class="actionButtons" tal:condition="view/availableActions">
<input tal:repeat="action view/actions"
tal:replace="structure action/render"
Expand Down

0 comments on commit a5eda97

Please sign in to comment.