• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python reviewboard.initialize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中reviewboard.initialize函数的典型用法代码示例。如果您正苦于以下问题:Python initialize函数的具体用法?Python initialize怎么用?Python initialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了initialize函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main(settings, in_subprocess):
    if dirname(settings.__file__) == os.getcwd():
        sys.stderr.write("manage.py should not be run from within the "
                         "'reviewboard' Python package directory.\n")
        sys.stderr.write("Make sure to run this from the top of the "
                         "Review Board source tree.\n")
        sys.exit(1)

    if (len(sys.argv) > 1 and
        (sys.argv[1] == 'runserver' or sys.argv[1] == 'test')):
        if settings.DEBUG and not in_subprocess:
            sys.stderr.write('Running dependency checks (set DEBUG=False '
                             'to turn this off)...\n')
            check_dependencies(settings)

        if sys.argv[1] == 'runserver':
            # Force using HTTP/1.1 for all responses, in order to work around
            # some browsers (Chrome) failing to consistently handle some
            # cache headers.
            simple_server.ServerHandler.http_version = '1.1'
    else:
        # Some of our checks require access to django.conf.settings, so
        # tell Django about our settings.
        #
        # Initialize Review Board, so we're in a state ready to load
        # extensions and run management commands.
        from reviewboard import initialize
        initialize()

        include_enabled_extensions(settings)

    execute_from_command_line(sys.argv)
开发者ID:darmhoo,项目名称:reviewboard,代码行数:32,代码来源:manage.py


示例2: main

def main(settings):
    if dirname(settings.__file__) == os.getcwd():
        sys.stderr.write("manage.py should not be run from within the "
                         "'reviewboard' Python package directory.\n")
        sys.stderr.write("Make sure to run this from the top of the "
                         "Review Board source tree.\n")
        sys.exit(1)

    if len(sys.argv) > 1 and \
       (sys.argv[1] == 'runserver' or sys.argv[1] == 'test'):
        if settings.DEBUG:
            # If DJANGO_SETTINGS_MODULE is in our environment, we're in
            # execute_from_command_line's sub-process.  It doesn't make sense
            # to do this check twice, so just return.
            if 'DJANGO_SETTINGS_MODULE' not in os.environ:
                sys.stderr.write('Running dependency checks (set DEBUG=False '
                                 'to turn this off)...\n')
                check_dependencies(settings)
    else:
        # Some of our checks require access to django.conf.settings, so
        # tell Django about our settings.
        #
        # Initialize Review Board, so we're in a state ready to load
        # extensions and run management commands.
        from reviewboard import initialize
        initialize()

        include_enabled_extensions(settings)

    execute_from_command_line(sys.argv)
开发者ID:javins,项目名称:reviewboard,代码行数:30,代码来源:manage.py


示例3: setUp

    def setUp(self):
        super(TestCase, self).setUp()

        initialize()

        # Clear the cache so that previous tests don't impact this one.
        cache.clear()
开发者ID:kuoxin,项目名称:reviewboard,代码行数:7,代码来源:testcase.py


示例4: main

def main(settings, in_subprocess):
    if dirname(settings.__file__) == os.getcwd():
        sys.stderr.write("manage.py should not be run from within the "
                         "'reviewboard' Python package directory.\n")
        sys.stderr.write("Make sure to run this from the top of the "
                         "Review Board source tree.\n")
        sys.exit(1)

    if (len(sys.argv) > 1 and
        (sys.argv[1] == 'runserver' or sys.argv[1] == 'test')):
        if settings.DEBUG and not in_subprocess:
            sys.stderr.write('Running dependency checks (set DEBUG=False '
                             'to turn this off)...\n')
            check_dependencies(settings)
    else:
        # Some of our checks require access to django.conf.settings, so
        # tell Django about our settings.
        #
        # Initialize Review Board, so we're in a state ready to load
        # extensions and run management commands.
        from reviewboard import initialize
        initialize()

        include_enabled_extensions(settings)

    execute_from_command_line(sys.argv)
开发者ID:salam0smy,项目名称:reviewboard,代码行数:26,代码来源:manage.py


示例5: setUp

    def setUp(self):
        initialize()

        mail.outbox = []
        self.sender = '[email protected]'

        siteconfig = SiteConfiguration.objects.get_current()
        siteconfig.set("mail_send_new_user_mail", True)
        siteconfig.save()
        load_site_config()
开发者ID:CrystalLokKoo,项目名称:reviewboard,代码行数:10,代码来源:tests.py


示例6: setUp

    def setUp(self):
        initialize()

        mail.outbox = []
        self.sender = "[email protected]"

        siteconfig = SiteConfiguration.objects.get_current()
        siteconfig.set("mail_send_review_mail", True)
        siteconfig.set("mail_default_from", self.sender)
        siteconfig.save()
        load_site_config()
开发者ID:helloconan,项目名称:reviewboard,代码行数:11,代码来源:tests.py


示例7: main

def main(in_subprocess):
    # Some of our checks require access to django.conf.settings, so
    # tell Django about our settings.
    #
    # Initialize Review Board, so we're in a state ready to load
    # extensions and run management commands.
    from reviewboard import settings, initialize
    initialize()

    include_enabled_extensions(settings)

    high_priority_reviews = get_high_priority_reviews()

    send_email_reminder(high_priority_reviews)
开发者ID:jjst,项目名称:rbpriority,代码行数:14,代码来源:alert.py


示例8: main

def main(settings, in_subprocess):
    if dirname(settings.__file__) == os.getcwd():
        sys.stderr.write("manage.py should not be run from within the "
                         "'reviewboard' Python package directory.\n")
        sys.stderr.write("Make sure to run this from the top of the "
                         "Review Board source tree.\n")
        sys.exit(1)

    try:
        command_name = sys.argv[1]
    except IndexError:
        command_name = None

    if command_name in ('runserver', 'test'):
        if settings.DEBUG and not in_subprocess:
            sys.stderr.write('Running dependency checks (set DEBUG=False '
                             'to turn this off)...\n')
            check_dependencies(settings)

        if command_name == 'runserver':
            # Force using HTTP/1.1 for all responses, in order to work around
            # some browsers (Chrome) failing to consistently handle some
            # cache headers.
            simple_server.ServerHandler.http_version = '1.1'
    elif command_name not in ('syncdb', 'migrate'):
        # Some of our checks require access to django.conf.settings, so
        # tell Django about our settings.
        #
        # Initialize Review Board, so we're in a state ready to load
        # extensions and run management commands.
        #
        # Note that we don't do this for operations that may create the
        # database, since we don't want to run the risk of initialization
        # callbacks causing database creation to fail. (rb-site does not
        # initialize during its site creation process.)
        from reviewboard import initialize
        initialize()

        if command_name == 'upgrade':
            # We want to handle this command specially. This function will
            # perform its own command line executions, so bail after it's
            # done.
            upgrade_database()
            return

        include_enabled_extensions(settings)

    execute_from_command_line(sys.argv)
开发者ID:chipx86,项目名称:reviewboard,代码行数:48,代码来源:manage.py


示例9: setUp

    def setUp(self):
        initialize()

        siteconfig = SiteConfiguration.objects.get_current()
        siteconfig.set("mail_send_review_mail", True)
        siteconfig.save()
        mail.outbox = []

        svn_repo_path = os.path.join(os.path.dirname(__file__), "../scmtools/testdata/svn_repo")
        self.repository = Repository(
            name="Subversion SVN", path="file://" + svn_repo_path, tool=Tool.objects.get(name="Subversion")
        )
        self.repository.save()

        self.client.login(username="grumpy", password="grumpy")
        self.user = User.objects.get(username="grumpy")
开发者ID:smorley,项目名称:reviewboard,代码行数:16,代码来源:tests.py


示例10: setUp

    def setUp(self):
        super(BaseWebAPITestCase, self).setUp()

        initialize()

        self.siteconfig = SiteConfiguration.objects.get_current()
        self.siteconfig.set("mail_send_review_mail", False)
        self.siteconfig.set("auth_require_sitewide_login", False)
        self.siteconfig.save()
        self._saved_siteconfig_settings = self.siteconfig.settings.copy()

        mail.outbox = []

        fixtures = getattr(self, 'fixtures', [])

        if 'test_users' in fixtures:
            self.client.login(username="grumpy", password="grumpy")
            self.user = User.objects.get(username="grumpy")

        self.base_url = 'http://testserver'
开发者ID:markrcote,项目名称:reviewboard,代码行数:20,代码来源:base.py


示例11: process_request

 def process_request(self, request):
     if not self._initialized:
         initialize()
         self._initialized = True
开发者ID:aaronmartin0303,项目名称:reviewboard,代码行数:4,代码来源:middleware.py


示例12: process_request

 def process_request(self, request):
     """Ensure that Review Board initialization code has run."""
     if not self._initialized:
         initialize()
         self._initialized = True
开发者ID:CharanKamal-CLI,项目名称:reviewboard,代码行数:5,代码来源:middleware.py


示例13: initialize

from reviewboard.webapi.resources import resources
from sphinx import addnodes
from sphinx.util import docname_join
from sphinx.util.compat import Directive


# Mapping of mimetypes to language names for syntax highlighting.
MIMETYPE_LANGUAGES = [
    ('application/json', 'javascript'),
    ('application/xml', 'xml'),
    ('text/x-patch', 'diff'),
]


# Initialize Review Board
initialize()


# Build the list of parents.
resources.root.get_url_patterns()


class ResourceNotFound(Exception):
    def __init__(self, directive, classname):
        self.classname = classname
        self.error_node = [
            directive.state_machine.reporter.error(
                str(self),
                line=directive.lineno)
        ]
开发者ID:is00hcw,项目名称:reviewboard,代码行数:30,代码来源:webapidocs.py


示例14: setUp

 def setUp(self):
     """Set up this test case."""
     initialize()
开发者ID:priestd09,项目名称:reviewboard,代码行数:3,代码来源:tests.py


示例15: main

def main():
    """Run the application."""
    os.environ.setdefault(b'DJANGO_SETTINGS_MODULE', b'reviewboard.settings')

    if DEBUG:
        pid = os.getpid()
        log_filename = 'rbssh-%s.log' % pid

        if DEBUG_LOGDIR:
            log_path = os.path.join(DEBUG_LOGDIR, log_filename)
        else:
            log_path = log_filename

        logging.basicConfig(level=logging.DEBUG,
                            format='%(asctime)s %(name)-18s %(levelname)-8s '
                                   '%(message)s',
                            datefmt='%m-%d %H:%M',
                            filename=log_path,
                            filemode='w')

        logging.debug('%s' % sys.argv)
        logging.debug('PID %s' % pid)

    initialize()

    ch = logging.StreamHandler()
    ch.setLevel(logging.INFO)
    ch.setFormatter(logging.Formatter('%(message)s'))
    ch.addFilter(logging.Filter('root'))
    logging.getLogger('').addHandler(ch)

    path, port, command = parse_options(sys.argv[1:])

    if '://' not in path:
        path = 'ssh://' + path

    username, hostname = SCMTool.get_auth_from_uri(path, options.username)

    if username is None:
        username = getpass.getuser()

    logging.debug('!!! %s, %s, %s' % (hostname, username, command))

    client = SSHClient(namespace=options.local_site_name)
    client.set_missing_host_key_policy(paramiko.WarningPolicy())

    attempts = 0
    password = None

    key = client.get_user_key()

    while True:
        try:
            client.connect(hostname, port, username=username,
                           password=password, pkey=key,
                           allow_agent=options.allow_agent)
            break
        except paramiko.AuthenticationException as e:
            if attempts == 3 or not sys.stdin.isatty():
                logging.error('Too many authentication failures for %s' %
                              username)
                sys.exit(1)

            attempts += 1
            password = getpass.getpass("%[email protected]%s's password: " %
                                       (username, hostname))
        except paramiko.SSHException as e:
            logging.error('Error connecting to server: %s' % e)
            sys.exit(1)
        except Exception as e:
            logging.error('Unknown exception during connect: %s (%s)' %
                          (e, type(e)))
            sys.exit(1)

    transport = client.get_transport()
    channel = transport.open_session()

    if sys.platform in ('cygwin', 'win32'):
        logging.debug('!!! Using WindowsHandler')
        handler = WindowsHandler(channel)
    else:
        logging.debug('!!! Using PosixHandler')
        handler = PosixHandler(channel)

    if options.subsystem == 'sftp':
        logging.debug('!!! Invoking sftp subsystem')
        channel.invoke_subsystem('sftp')
        handler.transfer()
    elif command:
        logging.debug('!!! Sending command %s' % command)
        channel.exec_command(' '.join(command))
        handler.transfer()
    else:
        logging.debug('!!! Opening shell')
        channel.get_pty()
        channel.invoke_shell()
        handler.shell()

    logging.debug('!!! Done')
    status = channel.recv_exit_status()
#.........这里部分代码省略.........
开发者ID:CharanKamal-CLI,项目名称:reviewboard,代码行数:101,代码来源:rbssh.py


示例16: setUp

 def setUp(self):
     initialize()
     siteconfig = SiteConfiguration.objects.get_current()
     siteconfig.set("mail_send_review_mail", True)
     siteconfig.save()
     mail.outbox = []
开发者ID:yang,项目名称:reviewboard,代码行数:6,代码来源:tests.py


示例17: setUp

 def setUp(self):
     initialize()
开发者ID:down-networks,项目名称:reviewboard,代码行数:2,代码来源:tests.py



注:本文中的reviewboard.initialize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python reviewboard.is_release函数代码示例发布时间:2022-05-26
下一篇:
Python reviewboard.get_version_string函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap