comparison rhodecode/lib/db_manage.py @ 3625:260a7a01b054 beta

follow Python conventions for boolean values True and False might be singletons and the "default" values for "boolean" expressions, but "all" values in Python has a boolean value and should be evaluated as such. Checking with 'is True' and 'is False' is thus confusing, error prone and unnessarily complex. If we anywhere rely and nullable boolean fields from the database layer and don't want the null value to be treated as False then we should check explicitly for null with 'is None'.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 28 Mar 2013 01:10:45 +0100
parents b3cf4539d1bd
children 10b4e34841a4
comparison
equal deleted inserted replaced
3624:4dddb7ee8865 3625:260a7a01b054
67 self.db_exists = False 67 self.db_exists = False
68 self.cli_args = cli_args 68 self.cli_args = cli_args
69 self.init_db() 69 self.init_db()
70 global ask_ok 70 global ask_ok
71 71
72 if self.cli_args.get('force_ask') is True: 72 if self.cli_args.get('force_ask'):
73 ask_ok = lambda *args, **kwargs: True 73 ask_ok = lambda *args, **kwargs: True
74 elif self.cli_args.get('force_ask') is False: 74 elif not self.cli_args.get('force_ask'):
75 ask_ok = lambda *args, **kwargs: False 75 ask_ok = lambda *args, **kwargs: False
76 76
77 def init_db(self): 77 def init_db(self):
78 engine = create_engine(self.dburi, echo=self.log_sql) 78 engine = create_engine(self.dburi, echo=self.log_sql)
79 init_model(engine) 79 init_model(engine)
587 path_ok = False 587 path_ok = False
588 log.error('No write permission to given path %s' % path) 588 log.error('No write permission to given path %s' % path)
589 589
590 if retries == 0: 590 if retries == 0:
591 sys.exit('max retries reached') 591 sys.exit('max retries reached')
592 if path_ok is False: 592 if not path_ok:
593 retries -= 1 593 retries -= 1
594 return self.config_prompt(test_repo_path, retries) 594 return self.config_prompt(test_repo_path, retries)
595 595
596 real_path = os.path.normpath(os.path.realpath(path)) 596 real_path = os.path.normpath(os.path.realpath(path))
597 597