Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
58f6c46d
Commit
58f6c46d
authored
Oct 18, 2018
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
product/ERP5Form/HoneypotField: remove useless code
parent
9ab8c888
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
16 deletions
+3
-16
product/ERP5Form/HoneypotField.py
product/ERP5Form/HoneypotField.py
+3
-16
No files found.
product/ERP5Form/HoneypotField.py
View file @
58f6c46d
...
...
@@ -7,25 +7,13 @@ class HoneypotWidget(Widget.Widget):
"""Honeypot widget
"""
property_names
=
Widget
.
Widget
.
property_names
+
\
[
'input_type'
,
'extra'
]
[
'extra'
]
default
=
Widget
.
TextWidget
.
default
input_type
=
fields
.
StringField
(
'input_type'
,
title
=
'Input type'
,
description
=
(
"The type of the input field like 'color', 'date', 'email' etc."
"Note input types, not supported by old web browsers, will behave "
"as input type text."
),
default
=
"text"
,
required
=
0
)
def
render
(
self
,
field
,
key
,
value
,
REQUEST
,
render_prefix
=
None
):
"""Honey pot input field.
"""
input_type
=
field
.
get_value
(
'input_type'
)
or
'text'
return
Widget
.
render_element
(
"input"
,
type
=
input_type
,
type
=
'text'
,
name
=
key
,
css_class
=
field
.
get_value
(
'css_class'
),
value
=
value
,
...
...
@@ -45,8 +33,7 @@ class HoneypotValidator(Validator.Validator):
no_validator
=
'A bot may try to submit.'
def
validate
(
self
,
field
,
key
,
REQUEST
):
# We had to add this patch for hidden fields of type "list"
value
=
REQUEST
.
get
(
key
,
REQUEST
.
get
(
'default_%s'
%
(
key
,
)))
value
=
REQUEST
.
get
(
key
,
None
)
default_value
=
field
.
get_value
(
'default'
)
if
value
is
None
or
value
!=
default_value
:
#this field is not sent or sent with value added by bot
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment