Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#994 closed enhancement (fixed)

Edit Profile: It should be possible to add Website-URLs without "http://"

Reported by: markus Owned by:
Priority: trivial Milestone:
Component: programming Keywords:
Cc: berkerpeksag, Christopher Allan Webber Parent Tickets:

Description

Currently, if you want to add a website-url to your profile, you have to include the string "http://", otherwise you get an error stating "the url is in the wrong format". It should not be necessary to include "http://" in the url.

Subtickets

Attachments (3)

issue_994.patch (2.8 KB) - added by Ben Sturmfels 6 years ago.
issue_994v2.patch (4.1 KB) - added by Ben Sturmfels 6 years ago.
issue_994_test_fix.patch (896 bytes) - added by Ben Sturmfels 6 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by markus

Summary: Edit Profile: Adding Website-URL without "http://" not possibleEdit Profile: It should be possible to add Website-URLs without "http://"

comment:2 Changed 6 years ago by Ben Sturmfels

I've attached a patch to allow people to not enter the http:// or https:// part of the website URL. If it's not provided, a prefix of http:// will be used.

Regards,
Ben

Changed 6 years ago by Ben Sturmfels

Attachment: issue_994.patch added

comment:3 Changed 6 years ago by ayleph

Cc: berkerpeksag Christopher Allan Webber added
Status: newreview

Seems reasonable to me. If we're going to offer an explicit 'Website' box on the Edit Profile page, we might as well assume that a http(s) URI is going to be entered. CC'ing berker for review, and also cwebber in case he has any thoughts.

comment:4 Changed 6 years ago by berkerpeksag

+ if not (data.startswith(u'http://') or data.startswith(u'https://')):

or if not data.startswith((u'http://', u'https://')):

Could you also pass a description parameter to WebsiteField to explain the new behavior? So people will notice that they don't have to write the http:// part.

Thanks!

comment:5 Changed 6 years ago by Ben Sturmfels

Thanks Berker, I wasn't aware of that feature in startswith. I've also added a description with "www.example.com" to suggest that http:// part isn't required. What do you think?

Changed 6 years ago by Ben Sturmfels

Attachment: issue_994v2.patch added

comment:7 Changed 6 years ago by Ben Sturmfels

Hi Berker,

Thanks very much for merging this and also improving process_formdata to handle null/empty valuelist.

Unfortunately I think the other small tweak you made to the body broke the function for the case when there is already an http or https prefix, as shown in failing test test_edit.test_change_bio_url.

Patch attached.

Cheers,
Ben

Changed 6 years ago by Ben Sturmfels

Attachment: issue_994_test_fix.patch added
Note: See TracTickets for help on using tickets.