~ubuntu-branches/ubuntu/vivid/openstack-trove/vivid

« back to all changes in this revision

Viewing changes to trove/guestagent/db/models.py

  • Committer: Package Import Robot
  • Author(s): Corey Bryant, Chuck Short, Corey Bryant
  • Date: 2015-01-06 13:39:46 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20150106133946-fqecrqyhzcw5nj0i
Tags: 2015.1~b1-0ubuntu1
[ Chuck Short ]
* Open up for vivid.
* debian/control: Update bzr branches. 

[ Corey Bryant ]
* New upstream release.
  - d/control: Align requirements with upstream.
  - d/watch: Update uversionmangle for kilo beta naming.
  - d/p/fix-requirements: Align requirements with Ubuntu.
* d/control: Bumped Standards-Version to 3.9.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import netaddr
20
20
 
21
21
from trove.common import cfg
 
22
from trove.openstack.common.gettextutils import _
22
23
 
23
24
CONF = cfg.CONF
24
25
 
304
305
            pass
305
306
        elif self._character_set:
306
307
            if value not in self.charset[self._character_set]:
307
 
                msg = "'%s' not a valid collation for charset '%s'"
308
 
                raise ValueError(msg % (value, self._character_set))
 
308
                msg = (_("%(val)s not a valid collation for charset %(char)s.")
 
309
                       % {'val': value, 'char': self._character_set})
 
310
                raise ValueError(msg)
309
311
            self._collate = value
310
312
        else:
311
313
            if value not in self.collation:
312
 
                raise ValueError("'%s' not a valid collation" % value)
 
314
                raise ValueError(_("'%s' not a valid collation.") % value)
313
315
            self._collate = value
314
316
            self._character_set = self.collation[value]
315
317
 
327
329
        if not value:
328
330
            pass
329
331
        elif not value in self.charset:
330
 
            raise ValueError("'%s' not a valid character set" % value)
 
332
            raise ValueError(_("'%s' not a valid character set.") % value)
331
333
        else:
332
334
            self._character_set = value
333
335
 
339
341
                not self._is_valid(value),
340
342
                not self.dbname.match(value),
341
343
                string.find("%r" % value, "\\") != -1]):
342
 
            raise ValueError("'%s' is not a valid database name" % value)
 
344
            raise ValueError(_("'%s' is not a valid database name.") % value)
343
345
        elif len(value) > 64:
344
 
            msg = "Database name '%s' is too long. Max length = 64"
 
346
            msg = _("Database name '%s' is too long. Max length = 64.")
345
347
            raise ValueError(msg % value)
346
348
        else:
347
349
            self._name = value
398
400
    @name.setter
399
401
    def name(self, value):
400
402
        if not self._is_valid_user_name(value):
401
 
            raise ValueError("'%s' is not a valid user name." % value)
 
403
            raise ValueError(_("'%s' is not a valid user name.") % value)
402
404
        elif len(value) > 16:
403
 
            raise ValueError("User name '%s' is too long. Max length = 16." %
404
 
                             value)
 
405
            raise ValueError(_("User name '%s' is too long. Max length = 16.")
 
406
                             % value)
405
407
        else:
406
408
            self._name = value
407
409
 
412
414
    @password.setter
413
415
    def password(self, value):
414
416
        if not self._is_valid(value):
415
 
            raise ValueError("'%s' is not a valid password." % value)
 
417
            raise ValueError(_("'%s' is not a valid password.") % value)
416
418
        else:
417
419
            self._password = value
418
420
 
435
437
    @host.setter
436
438
    def host(self, value):
437
439
        if not self._is_valid_host_name(value):
438
 
            raise ValueError("'%s' is not a valid hostname." % value)
 
440
            raise ValueError(_("'%s' is not a valid hostname.") % value)
439
441
        else:
440
442
            self._host = value
441
443