Ravi Gohil (OpenERP) has proposed merging
lp:~openerp-dev/openobject-client/6.1-opw-573451-rgo into
lp:openobject-client/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
Related bugs:
Bug #959066 in OpenERP GTK Client: "Restoring database"
https://bugs.launchpad.net/openobject-client/+bug/959066
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client/6.1-opw-573451-rgo/+merge/100772
Hello,
GTK-Client allows user to set a New Database name with special characters while
restoring a database.
This fix restricts naming database with special characters and allows only
characters which are allowed by creation of database.
Kindly review it.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-client/6.1-opw-573451-rgo/+merge/100772
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-client/6.1-opw-573451-rgo.
=== modified file 'bin/modules/gui/main.py'
--- bin/modules/gui/main.py 2011-12-09 11:22:31 +0000
+++ bin/modules/gui/main.py 2012-04-04 12:18:19 +0000
@@ -1385,8 +1385,13 @@
return
url, db_name, passwd = self._choose_db_ent()
- if db_name:
+ if (db_name <> (False or '')) and (passwd <> (False or '')):
try:
+ id = rpc.session.db_exec(url, 'list', True)
+ if db_name in id:
+ common.warning(_("Could not create database."),
+ _('Database already exists !'), parent=self.window)
+ return
f = file(filename, 'rb')
data_b64 = base64.encodestring(f.read())
f.close()
@@ -1578,15 +1583,27 @@
change_button.connect_after('clicked', lambda a,b: _server_ask(b, win),
widget_url)
- res = win.run()
-
db = False
passwd = False
url = False
- if res == gtk.RESPONSE_OK:
+
+ while True:
+ res = win.run()
db = db_widget.get_text()
url = widget_url.get_text()
passwd = widget_pass.get_text()
+ if (res == gtk.RESPONSE_CANCEL):
+ self.window.present()
+ win.destroy()
+ url = db = passwd = False
+ return url, db, passwd
+ if (res == gtk.RESPONSE_OK) and (db in RESERVED_KEYWORDS):
+ common.warning(_("Sorry,'" + db + "' cannot be the name of the database,it's a Reserved Keyword."), _('Bad database name !'), parent=win)
+ continue
+ if (res == gtk.RESPONSE_OK) and ((not db) or (not re.match('^[a-zA-Z0-9][a-zA-Z0-9_]+$', db))):
+ common.warning(_('The database name must contain only normal characters or "_".\nYou must avoid all accents, space or special characters.'), _('Bad database name !'), parent=win)
+ else:
+ break
self.window.present()
win.destroy()
return url, db, passwd
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp