comparison rhodecode/lib/db_manage.py @ 3909:e87298ccdfdb beta

Add default for dashbord items and create default settings in a sane way.
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 28 May 2013 23:02:02 +0200
parents c7b919b2d90d
children 36f7562a5919
comparison
equal deleted inserted replaced
3908:b619d9eef67a 3909:e87298ccdfdb
635 635
636 def create_settings(self, path): 636 def create_settings(self, path):
637 637
638 self.create_ui_settings() 638 self.create_ui_settings()
639 639
640 #HG UI OPTIONS 640 ui_config = [
641 web1 = RhodeCodeUi() 641 ('web', 'push_ssl', 'false'),
642 web1.ui_section = 'web' 642 ('web', 'allow_archive', 'gz zip bz2'),
643 web1.ui_key = 'push_ssl' 643 ('web', 'allow_push', '*'),
644 web1.ui_value = 'false' 644 ('web', 'baseurl', '/'),
645 645 ('paths', '/', path),
646 web2 = RhodeCodeUi() 646 #('phases', 'publish', 'false')
647 web2.ui_section = 'web' 647 ]
648 web2.ui_key = 'allow_archive' 648 for section,key,value in ui_config:
649 web2.ui_value = 'gz zip bz2' 649 ui_conf = RhodeCodeUi()
650 650 setattr(ui_conf, 'ui_section', section)
651 web3 = RhodeCodeUi() 651 setattr(ui_conf, 'ui_key', key)
652 web3.ui_section = 'web' 652 setattr(ui_conf, 'ui_value', value)
653 web3.ui_key = 'allow_push' 653
654 web3.ui_value = '*' 654 settings = [
655 655 ('realm', 'RhodeCode authentication', unicode),
656 web4 = RhodeCodeUi() 656 ('title', 'RhodeCode', unicode),
657 web4.ui_section = 'web' 657 ('ga_code', '', unicode),
658 web4.ui_key = 'baseurl' 658 ('show_public_icon', True, bool),
659 web4.ui_value = '/' 659 ('show_private_icon', True, bool),
660 660 ('stylify_metatags', False, bool),
661 paths = RhodeCodeUi() 661 ('dashboard_items', 100, int),
662 paths.ui_section = 'paths' 662 ]
663 paths.ui_key = '/' 663 for key, val, type_ in settings:
664 paths.ui_value = path 664 sett = RhodeCodeSetting(key, val)
665 665 self.sa.add(sett)
666 phases = RhodeCodeUi()
667 phases.ui_section = 'phases'
668 phases.ui_key = 'publish'
669 phases.ui_value = False
670
671 sett1 = RhodeCodeSetting('realm', 'RhodeCode authentication')
672 sett2 = RhodeCodeSetting('title', 'RhodeCode')
673 sett3 = RhodeCodeSetting('ga_code', '')
674
675 sett4 = RhodeCodeSetting('show_public_icon', True)
676 sett5 = RhodeCodeSetting('show_private_icon', True)
677 sett6 = RhodeCodeSetting('stylify_metatags', False)
678
679 self.sa.add(web1)
680 self.sa.add(web2)
681 self.sa.add(web3)
682 self.sa.add(web4)
683 self.sa.add(paths)
684 self.sa.add(sett1)
685 self.sa.add(sett2)
686 self.sa.add(sett3)
687 self.sa.add(sett4)
688 self.sa.add(sett5)
689 self.sa.add(sett6)
690 666
691 self.create_ldap_options() 667 self.create_ldap_options()
692 self.create_default_options() 668 self.create_default_options()
693 669
694 log.info('created ui config') 670 log.info('created ui config')