--- a/opensourceprojects/controllers.py
+++ b/opensourceprojects/controllers.py
@@ -9,7 +9,12 @@
from tg import expose, session, flash, redirect, validate, config
from tg.decorators import with_trailing_slash, without_trailing_slash
-from pylons import c, g, request, response
+
+try:
+ from pylons import c, g, request, response
+except ImportError:
+ # in Allura 1.0 c,g cannot be imported directly
+ from pylons import tmpl_context as c, app_globals as g
import ew as ew_core
import ew.jinja2_ew as ew
@@ -23,6 +28,12 @@
log = logging.getLogger(__name__)
+try:
+ username_re_validator = h.re_path_portion
+except:
+ # Since Allura 1.0
+ username_re_validator = h.re_project_name
+
class OSPRegistrationForm(forms.ForgeForm):
template = 'jinja:opensourceprojects:templates/widgets/forge_form.html'
class fields(ew_core.NameList):
@@ -34,7 +45,7 @@
)
username = ew.TextField(
label='Desired Username',
- validator=fev.Regex(h.re_path_portion, not_empty=True),
+ validator=fev.Regex(username_re_validator, not_empty=True),
attrs={'placeholder':'Username', 'class':'username'},
show_label=False
)