-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more lines for blogs and rss feeds. Fixes: 1409 #1410
Conversation
d758b03
to
8666eac
Compare
Signed-off-by: Pedro Moura <[email protected]>
Signed-off-by: Aurélien Bompard <[email protected]>
Signed-off-by: Aurélien Bompard <[email protected]>
Signed-off-by: Aurélien Bompard <[email protected]>
Signed-off-by: Aurélien Bompard <[email protected]>
Signed-off-by: Aurélien Bompard <[email protected]>
OK I made quite a few commits, one of them is adjusting to the fact that |
Would it be possible to enforce https here too? |
That would help users because planet drops HTTP links. |
Sure, WTForms supports validators, there may be one for HTTPS urls in the URLFields, and if not there's always the regex validator |
Seems WTForms doesnt have a validator to check HTTPS, so I created a new class for it and wrote a few unit tests. Let me know if it needs more changes, maybe this PR is still a WIP |
Signed-off-by: Pedro Moura <[email protected]>
It's now blocking any link that doesn't start with HTTPS, but I'm still having trouble adding more lines to the |
Signed-off-by: Pedro Moura <[email protected]>
Signed-off-by: Pedro Moura <[email protected]>
It works now. Its possible to add multiple lines for Blog and RSS fields and it only allows HTTPS, but still need to add unit tests for |
1a222f2
to
1095b59
Compare
…SettingsProfileForm class Signed-off-by: Pedro Moura <[email protected]>
Signed-off-by: Pedro Moura <[email protected]>
Signed-off-by: Pedro Moura <[email protected]>
noggin/form/edit_user.py
Outdated
@@ -80,6 +81,10 @@ def _validate(form, field): | |||
|
|||
|
|||
class UserSettingsProfileForm(BaseForm): | |||
def _https_required(form, field): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make it a member of the class? This construct is a bit unusual, it should either be:
- outside the class, as before
- a method, but then it should have
self
as a first argument and called on the instance, which is not what we want for a validator - a class method, but then it should be decorated with
@classmethod
and takecls
as the first argument - a static method, but then it should be decorated with
@staticmethod
I think keeping it outside (option 1) is best here, so it can possibly be reused by another form later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I thought it'd be used only for that case, but if it can possibly be reused I agree with option 1. Just did the changes.
Signed-off-by: Pedro Moura <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Just changing here at noggin seems free-ipa and fasjson doesnt need to be updated, but let me know if it does or if this PR needs adjustments
related issue: #1409