This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created a templates directory and moved all the .tmpl template from t…
…he browser directory to the templates directory, updated the browser/export.py form code to grab templates from the new location. fixed the popup export form (removed formselector in themeeditor.js) so that the theme actually downloads. svn path=/plone.app.themeeditor/trunk/; revision=38772
- Loading branch information
1 parent
41e51dd
commit e849580
Showing
15 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from z3c.form import validator | ||
from z3c.form.interfaces import IValidator | ||
from zope.component import adapts | ||
from plone.app.themeeditor.browser.export import IThemeEditorExportForm | ||
from zope.interface import implements, Interface, Invalid | ||
|
||
class DottedNameValidator(validator.SimpleFieldValidator): | ||
implements(IValidator) | ||
adapts(Interface, IThemeEditorExportForm) | ||
|
||
def validate(self, value): | ||
super(DottedNameValidator, self).validate(value) | ||
|
||
|
||
names = value.split(".") | ||
if len(names) < 2: | ||
raise Invalid('''Not a valid theme name. There are no dots, the theme name must have a single dot | ||
separating two words e.g. "plonetheme.mytheme".''') | ||
if len(names) > 2: | ||
raise Invalid('''Not a valid dotted theme name. There | ||
should be no more than one dot in the theme name | ||
separating two words e.g. "plonetheme.mytheme".''') | ||
|
||
for name in names: | ||
# Check if Python identifier, | ||
# http://code.activestate.com/recipes/413487/ | ||
try: | ||
class test(object): __slots__ = [name] | ||
except TypeError: | ||
raise Invalid('''Not a valid dotted theme name. %s | ||
should be a simple word with no special | ||
characters | ||
e.g. "plonetheme.mytheme".''' % name) | ||
return True | ||
|
||
# Register DottedName validator for the name field in the IThemeEditorExportForm | ||
validator.WidgetValidatorDiscriminators(DottedNameValidator, | ||
field=IThemeEditorExportForm['name']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters