You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2020/10/30 17:15:30 UTC
[allura] branch master updated (a095ac6 -> 00845ba)
This is an automated email from the ASF dual-hosted git repository.
kentontaylor pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git.
from a095ac6 Test fix: create regular comments instead of "meta" comments from ticket edit
new 0c225ba Add permit_legacy flag to NeighborhoodProjectShortNameValidator in case a site has older names to allow during URL checks
new 00845ba Strip leading or trailing dashes when suggesting project shortnames
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
Allura/allura/controllers/rest.py | 2 +-
Allura/allura/lib/widgets/forms.py | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
[allura] 02/02: Strip leading or trailing dashes when suggesting
project shortnames
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 00845baf474c96d82afe3d562a716b0fd89051e1
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Oct 26 16:09:09 2020 -0400
Strip leading or trailing dashes when suggesting project shortnames
---
Allura/allura/lib/widgets/forms.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 2374e19..360859a 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -1066,7 +1066,7 @@ class NeighborhoodAddProjectForm(ForgeForm):
}
});
var suggest_name = function(project_name) {
- return project_name.replace(/[^A-Za-z0-9]+/g, '-').toLowerCase();
+ return project_name.replace(/[^A-Za-z0-9]+/g, '-').toLowerCase().replace(/^-+|-+$/g, '');
};
var check_names = function() {
var data = {
[allura] 01/02: Add permit_legacy flag to
NeighborhoodProjectShortNameValidator in case a site has older names to
allow during URL checks
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 0c225ba5bf5622013b47484f88583ca01b869087
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Oct 26 16:08:48 2020 -0400
Add permit_legacy flag to NeighborhoodProjectShortNameValidator in case a site has older names to allow during URL checks
---
Allura/allura/controllers/rest.py | 2 +-
Allura/allura/lib/widgets/forms.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index 24ee77d..db7c4a1 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -317,7 +317,7 @@ def nbhd_lookup_first_path(nbhd, name, current_user, remainder, api=False):
raise exc.HTTPNotFound
provider = plugin.ProjectRegistrationProvider.get()
try:
- provider.shortname_validator.to_python(pname, check_allowed=False, neighborhood=nbhd)
+ provider.shortname_validator.to_python(pname, check_allowed=False, neighborhood=nbhd, permit_legacy=True)
except Invalid:
project = None
else:
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 507ea41..2374e19 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -58,7 +58,7 @@ class _HTMLExplanation(ew.InputField):
class NeighborhoodProjectShortNameValidator(fev.FancyValidator):
- def _validate_shortname(self, shortname, neighborhood, state):
+ def _validate_shortname(self, shortname, neighborhood, state, permit_legacy=False):
if not h.re_project_name.match(shortname):
raise forge_exc.ProjectShortnameInvalid(
'Please use 3-15 small letters, numbers, and dashes.',
@@ -72,7 +72,7 @@ class NeighborhoodProjectShortNameValidator(fev.FancyValidator):
'This project name is taken.',
shortname, state)
- def to_python(self, value, state=None, check_allowed=True, neighborhood=None):
+ def to_python(self, value, state=None, check_allowed=True, neighborhood=None, permit_legacy=False):
"""
Validate a project shortname.
@@ -83,7 +83,7 @@ class NeighborhoodProjectShortNameValidator(fev.FancyValidator):
if neighborhood is None:
neighborhood = M.Neighborhood.query.get(name=state.full_dict['neighborhood'])
value = h.really_unicode(value or '')
- self._validate_shortname(value, neighborhood, state)
+ self._validate_shortname(value, neighborhood, state, permit_legacy=permit_legacy)
if check_allowed:
self._validate_allowed(value, neighborhood, state)
return value