Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tsauerwein
Copy link

The example for a custom widget in the docs builds an input field like this:

return u'<input type="text" value="%s">' % quoted

But the name property is not set, so no data would be submitted for this field.

@tisdall
Copy link
Contributor

tisdall commented Jun 25, 2014

My only issue with this change is that it's combining string concatenation with % formatting. Can you alter it so it's all % formatting?

@tsauerwein
Copy link
Author

Fully agree, I updated the branch.

@tisdall
Copy link
Contributor

tisdall commented Jun 26, 2014

one more nitpick... :) http://legacy.python.org/dev/peps/pep-0008/#maximum-line-length

instead of:

return '<input type="text" name="%s" \
    value="%s">' % (field.name, cgi.escape(cstruct, quote='"'))

you could do one of these:

return ('<input type="text" name="%s" '
    'value="%s">') % (field.name, cgi.escape(cstruct, quote='"'))

return ('<input type="text" name="%s" '
    'value="%s">' % (field.name, cgi.escape(cstruct, quote='"')))

return ('<input type="text" name="%s" value="%s">' % 
        (field.name, cgi.escape(cstruct, quote='"')))

Basically you want to avoid the backslash because it breaks if there's any white space directly after it and white space is hard to notice at the end of a line.

The example for a custom widget in the docs builds an input field like this:

    return u'<input type="text" value="%s">' % quoted

But the `name` property is not set, so no data would be submitted for this field.
@tsauerwein
Copy link
Author

Updated :)

@Themanwithoutaplan
Copy link
Contributor

@stevepiercy this should be merged.

@stevepiercy stevepiercy merged commit 0ca0421 into Pylons:master Aug 23, 2020
@stevepiercy
Copy link
Member

@tsauerwein thank you! Sorry for the long delay. I've recently taken on the role of maintainer for Deform.

stevepiercy added a commit to stevepiercy/deform that referenced this pull request Aug 23, 2020
stevepiercy added a commit to stevepiercy/deform that referenced this pull request Aug 23, 2020
stevepiercy added a commit that referenced this pull request Aug 23, 2020
Update widget docs per #226 for consistency across code examples
stevepiercy added a commit that referenced this pull request Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants