comparison roundup/backends/rdbms_common.py @ 7750:216662fbaaee

fix(i18n): fix incorrect lookup of some translations The code had: _("some term %s here" % term) this extracts the template, but looks up the string with %s replaced. So the translation is broken. Changed to: _("some term %s here") % term which looks up the template and substitutes in the translation of the template. Found by ruff INT ruleset.
author John Rouillard <rouilj@ieee.org>
date Fri, 01 Mar 2024 14:04:05 -0500
parents 4af0d235b570
children 8b31893f5930
comparison
equal deleted inserted replaced
7749:79344ea780ea 7750:216662fbaaee
627 # no changes 627 # no changes
628 return 0 628 return 0
629 629
630 if not self.config.RDBMS_ALLOW_ALTER: 630 if not self.config.RDBMS_ALLOW_ALTER:
631 raise DatabaseError(_( 631 raise DatabaseError(_(
632 'ALTER operation disallowed: %(old)r -> %(new)r.' % { 632 'ALTER operation disallowed: %(old)r -> %(new)r.') % {
633 'old': old_spec, 'new': new_spec})) 633 'old': old_spec, 'new': new_spec})
634 634
635 logger = logging.getLogger('roundup.hyperdb.backend') 635 logger = logging.getLogger('roundup.hyperdb.backend')
636 logger.info('update_class %s' % spec.classname) 636 logger.info('update_class %s' % spec.classname)
637 637
638 logger.debug('old_spec %r' % (old_spec,)) 638 logger.debug('old_spec %r' % (old_spec,))
862 def create_class(self, spec): 862 def create_class(self, spec):
863 """ Create a database table according to the given spec. 863 """ Create a database table according to the given spec.
864 """ 864 """
865 865
866 if not self.config.RDBMS_ALLOW_CREATE: 866 if not self.config.RDBMS_ALLOW_CREATE:
867 raise DatabaseError(_('CREATE operation disallowed: "%s".' % 867 raise DatabaseError(_('CREATE operation disallowed: "%s".') %
868 spec.classname)) 868 spec.classname)
869 869
870 cols, mls = self.create_class_table(spec) 870 cols, mls = self.create_class_table(spec)
871 self.create_journal_table(spec) 871 self.create_journal_table(spec)
872 872
873 # now create the multilink tables 873 # now create the multilink tables
879 879
880 Drop the journal and multilink tables too. 880 Drop the journal and multilink tables too.
881 """ 881 """
882 882
883 if not self.config.RDBMS_ALLOW_DROP: 883 if not self.config.RDBMS_ALLOW_DROP:
884 raise DatabaseError(_('DROP operation disallowed: "%s".' % cn)) 884 raise DatabaseError(_('DROP operation disallowed: "%s".') % cn)
885 885
886 properties = spec[1] 886 properties = spec[1]
887 # figure the multilinks 887 # figure the multilinks
888 mls = [] 888 mls = []
889 for propname, prop in properties: 889 for propname, prop in properties:
923 def addclass(self, cl): 923 def addclass(self, cl):
924 """ Add a Class to the hyperdatabase. 924 """ Add a Class to the hyperdatabase.
925 """ 925 """
926 cn = cl.classname 926 cn = cl.classname
927 if cn in self.classes: 927 if cn in self.classes:
928 raise ValueError(_('Class "%s" already defined.' % cn)) 928 raise ValueError(_('Class "%s" already defined.') % cn)
929 self.classes[cn] = cl 929 self.classes[cn] = cl
930 930
931 # add default Edit and View permissions 931 # add default Edit and View permissions
932 self.security.addPermission( 932 self.security.addPermission(
933 name="Create", klass=cn, 933 name="Create", klass=cn,

Roundup Issue Tracker: http://roundup-tracker.org/