summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/controllers/main.py11
-rw-r--r--addons/web/static/lib/qweb/qweb2.js5
-rw-r--r--addons/web/views/database_manager.html6
3 files changed, 14 insertions, 8 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index ed3e34762e5..b597c2eea55 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -54,6 +54,8 @@ env.filters["json"] = json.dumps
# 1 week cache for asset bundles as advised by Google Page Speed
BUNDLE_MAXAGE = 60 * 60 * 24 * 7
+DBNAME_PATTERN = '^[a-zA-Z0-9][a-zA-Z0-9_.-]+$'
+
#----------------------------------------------------------
# Odoo Web helpers
#----------------------------------------------------------
@@ -630,6 +632,7 @@ class Database(http.Controller):
d['list_db'] = odoo.tools.config['list_db']
d['langs'] = odoo.service.db.exp_list_lang()
d['countries'] = odoo.service.db.exp_list_countries()
+ d['pattern'] = DBNAME_PATTERN
# databases list
d['databases'] = []
try:
@@ -651,8 +654,8 @@ class Database(http.Controller):
@http.route('/web/database/create', type='http', auth="none", methods=['POST'], csrf=False)
def create(self, master_pwd, name, lang, password, **post):
try:
- if not re.match('^[a-zA-Z][a-zA-Z0-9_]+$', name):
- raise Exception(_('Invalid database name. Only alphanumerical characters and underscore are allowed.'))
+ if not re.match(DBNAME_PATTERN, name):
+ raise Exception(_('Invalid database name. Only alphanumerical characters, underscore, hyphen and dot are allowed.'))
# country code could be = "False" which is actually True in python
country_code = post.get('country_code') or False
dispatch_rpc('db', 'create_database', [master_pwd, name, bool(post.get('demo')), lang, password, post['login'], country_code])
@@ -665,8 +668,8 @@ class Database(http.Controller):
@http.route('/web/database/duplicate', type='http', auth="none", methods=['POST'], csrf=False)
def duplicate(self, master_pwd, name, new_name):
try:
- if not re.match('^[a-zA-Z][a-zA-Z0-9_]+$', new_name):
- raise Exception(_('Invalid database name. Only alphanumerical characters and underscore are allowed.'))
+ if not re.match(DBNAME_PATTERN, new_name):
+ raise Exception(_('Invalid database name. Only alphanumerical characters, underscore, hyphen and dot are allowed.'))
dispatch_rpc('db', 'duplicate_database', [master_pwd, name, new_name])
return http.local_redirect('/web/database/manager')
except Exception, e:
diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js
index 1e854a6960c..378c5eb6023 100644
--- a/addons/web/static/lib/qweb/qweb2.js
+++ b/addons/web/static/lib/qweb/qweb2.js
@@ -129,12 +129,15 @@ var QWeb2 = {
}
return r.join('');
} else {
+ // avoid XMLSerializer with text node for IE
+ if (node.nodeType == 3) {
+ return node.data;
+ }
if (typeof XMLSerializer !== 'undefined') {
return (new XMLSerializer()).serializeToString(node);
} else {
switch(node.nodeType) {
case 1: return node.outerHTML;
- case 3: return node.data;
case 4: return '<![CDATA[' + node.data + ']]>';
case 8: return '<!-- ' + node.data + '-->';
}
diff --git a/addons/web/views/database_manager.html b/addons/web/views/database_manager.html
index 629d2a622ec..991578b2469 100644
--- a/addons/web/views/database_manager.html
+++ b/addons/web/views/database_manager.html
@@ -60,7 +60,7 @@
<div class="row">
<div class="col-md-12">
<label for="name" class="control-label">Database Name</label>
- <input id="name" type="text" name="name" class="form-control" required="required" autocomplete="off" pattern="^[a-zA-Z][a-zA-Z0-9_]+$" title="Only alphanumerical characters and underscore are allowed"/>
+ <input id="name" type="text" name="name" class="form-control" required="required" autocomplete="off" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
</div>
</div>
</div>
@@ -207,7 +207,7 @@
</div>
<div class="form-group">
<label for="name" class="control-label">Database Name</label>
- <input id="name" type="text" name="name" class="form-control" required="required" pattern="^[a-zA-Z][a-zA-Z0-9_]+$" title="Only alphanumerical characters and underscore are allowed"/>
+ <input id="name" type="text" name="name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
</div>
<div class="form-group">
<label for="copy">This database might have been moved or copied.</label>
@@ -280,7 +280,7 @@
</div>
<div class="form-group">
<label for="new_name" class="control-label">New Name</label>
- <input id="new_name" type="text" name="new_name" class="form-control" required="required" pattern="^[a-zA-Z][a-zA-Z0-9_]+$" title="Only alphanumerical characters and underscore are allowed"/>
+ <input id="new_name" type="text" name="new_name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
</div>
</div>
<div class="modal-footer">