~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/base/forms.py

  • Committer: Matt Giuca
  • Date: 2010-02-23 05:27:07 UTC
  • Revision ID: matt.giuca@gmail.com-20100223052707-3a76wo23r2z503t8
browser.js: Adjusted condition for enabling "Commit" action; now allowed if
    no files are selected AND current directory is versioned (as well as if
    all selected files are versioned). Committing with 0 files selected will
    commit the current directory.
ivle.fileservice_lib.action: Fixed to allow commit to contain 0 paths. This
    will commit the current directory instead.
This fixes Launchpad bug #526161.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
18
 
import re
19
 
 
20
18
import formencode
21
 
import formencode.validators
22
19
from genshi.filters import HTMLFormFiller
23
20
 
24
21
from ivle.webapp.base.xhtml import XHTMLView
25
22
 
26
 
 
27
23
class BaseFormView(XHTMLView):
28
24
    """A base form view."""
29
25
 
106
102
            ctx['error_value'] = errors
107
103
 
108
104
 
109
 
VALID_URL_NAME = re.compile(r'^[a-z0-9][a-z0-9_\+\.\-]*$')
110
 
 
111
 
 
112
 
class URLNameValidator(formencode.validators.UnicodeString):
113
 
    def validate_python(self, value, state):
114
 
        super(URLNameValidator, self).validate_python(value, state)
115
 
        if not VALID_URL_NAME.match(value):
116
 
            raise formencode.Invalid(
117
 
                'Must consist of a lowercase alphanumeric character followed '
118
 
                'by any number of lowercase alphanumerics, ., +, - or _.',
119
 
                value, state)