Beispiel #1
0
    def setUp(self):
        self.env = InMemoryEnvironment('', create=True)
        self.db = self.env.get_db_cnx()

        self._admin = admin.TracAdmin()
        self._admin.env_set('', self.env)

        # Set test date to 11th Jan 2004
        self._test_date = time.strftime('%Y-%m-%d',
                                        (2004, 1, 11, 0, 0, 0, 6, 1, -1))
Beispiel #2
0
            shutil.copyfile(curdir + '/trac/Timeline.py',
                            tracDir + '/Timeline.py')
            shutil.copyfile(curdir + '/trac/About.py', tracDir + '/About.py')
            shutil.copyfile(curdir + '/trac/web/auth.py',
                            tracDir + '/web/auth.py')

            # 下面处理help页面
            import trac.scripts.admin as admin
            from trac.wiki.model import WikiPage
            from trac.env import Environment

            try:
                db_environ = os.path.abspath(sys.argv[2])
                print 'db path is %s' % db_environ
                myEnv = Environment(db_environ)
                myAdmin = admin.TracAdmin(db_environ)
                # 批量加入
                # 还没思考到同名wiki的情况
                myAdmin._do_wiki_load(curdir + '/zhwiki-default')
                print 'load chinese help finish'
            except:
                print 'can not import chinese help files '
                import traceback
                traceback.print_exc()
                sys.exit(1)
            # 修改原英文帮助文件
            # 加入中文的帮助文件地址
            try:
                # 得到帮助文件名
                # 不应该使用wiki-default,应该使用zhwiki-default目录的listdir()
                # 因为有可以没有一些页面的中文版本
Beispiel #3
0
def tranReport(action):
    #定义字典
    ZhReport = {
        """
 * List all active tickets by priority.
 * Color each row based on priority.
 * If a ticket has been accepted, a '*' is appended after the owner's name
""":
        u'''
 * 按优先级列出所有的活动传票
 * 颜色表示不同的优先级
 * 认领者认领的传票后,会有一个'*'加到的名字后面''',
        """
This report shows how to color results by priority,
while grouping results by version.

Last modification time, description and reporter are included as hidden fields
for useful RSS export.
""":
        u'''
本报表按版本分组,和按优先级列出不同颜色的结果.

当使用RSS阅读时,最后修改时间,描述与及创建人是被隐藏的''',
        """
This report shows how to color results by priority,
while grouping results by milestone.

Last modification time, description and reporter are included as hidden fields
for useful RSS export.
""":
        u'''
本报表按里程碑分组,和按优先级列出不同颜色的结果.

当使用RSS阅读时,最后修改时间,描述与及创建人是被隐藏的''',
        """
List assigned tickets, group by ticket owner, sorted by priority.
""":
        u'''
按传票认领者分组,按优先级排列''',
        """
List tickets assigned, group by ticket owner.
This report demonstrates the use of full-row display.
""":
        u'''
按创建者分组,列出已分配的活动传票,此报表使用全描述''',
        """
A more complex example to show how to make advanced reports.
""":
        u'''
复杂的查询例子,用于展示高级查询''',
        """
This report demonstrates the use of the automatically set 
USER dynamic variable, replaced with the username of the
logged in user when executed.
""":
        u'''
该报告展示了如何使用自动设置用户动态变量,将其替换为登录用户的用户名的方法。''',
        """
 * List all active tickets by priority.
 * Show all tickets owned by the logged in user in a group first.
""":
        u'''
 * 根据优先级别列举所有传票。
 * 先显示组内登录用户的所有传票。''',
    }

    from trac.scripts import admin
    adminDb = admin.TracAdmin(sys.argv[2])
    if action == 'cn':
        for key, value in ZhReport.iteritems():
            adminDb.db_update(
                'update report set description=%s where description=%s',
                params=(key, value))
        return
    elif action == 'en':
        for key, value in ZhReport.iteritems():
            adminDb.db_update(
                'update report set description=%s where description=%s',
                params=(value, key))
        return