免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 27502 | 回复: 4
打印 上一主题 下一主题

在Debian上安装MoinMoin服务器 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-15 08:37 |只看该作者 |倒序浏览
转自肥肥世家 http://www.ringkee.com

8.12. 安装MoinMoin服务器

MoinMoin是用Python语言写的一个开源WiKi服务器。它基于GNU GPL协议,使用简便、功能强大,通过Python很容易进行功能扩展。MoinMoin不使用后台数据库存放数据,而是以文本的形式存放在服务器中。debin Wiki网站使用的WiKi系统就是MoinMoin。

MoinMoin 不带Web服务器,需与Web服务器配合才能进行WiKi页面的发布。MoinMoin支持的Web服务器有Apache+CGI、Apache+ FastCgi、Apache+Mod_Python、IIS、TwistedWeb和WebLogic等。下面介绍一下MoinMoin+ TwistedWeb和Apache2+Mod_Python两种方式在Debian系统下的安装过程。

    *

      在安装MoinMoin前请安装好Python,最好使用最新的版本。安装MoinMoin的命令如下:

      debian:~# apt-get install python2.4-moinmoin moinmoin-common

      [Note]       
      安装软件包时要注意版本问题,2.3的包不能和2.4的包混用。

      MoinMoin的源码被安装到/usr/lib/python2.4/site-packages/MoinMoin目录。/usr/share/moin目录存放MoinMoin系统的模板,内容大致有以下几类:
          o

            /usr/share/moin/data目录存放WiKi Pages,Users,etc。只能被MoinMoin访问。
          o

            /usr/share/moin/underlay目录存放默认的WiKi Pages,有多种语言版本的帮助文档、默认页面文档等。只能被MoinMoin访问。
          o

            /usr/share/moin/htdocs目录存放网页元素,如图片、主题风格等。可被Web Server访问
          o

            /usr/share/moin/server目录存放服务器启动脚本示例。
          o

            /usr/share/moin/config目录存放配置文件示例。

      通过拷贝模板目录中的文件,就可生成不同的WiKi实例。MoinMoin的软件升级也很简单,只需用新版的模板文件下覆盖旧文就可以了。
    *

      创建MoinMoin实例

      在服务器上创建一个目录用于存放实例,目录名不能是wiki,它已被系统保留使用,一个不错的选择是mywiki。

      debian:~# mkdir mywiki

      从模板目录拷贝实例所需文件。

      debian:~# cp -rf /usr/share/moin/data ~/mywiki
      debian:~# cp -rf /usr/share/moin/underlay ~/mywiki
      debian:~# cp /usr/share/moin/config/wikiconfig.py ~/mywiki

    *

      设置实例目录权限

      Debian中的MoinMoin系统默认使用www-data用户运行WiKi服务器。所以我们的权限设置是:

      debian:~# chown -R www-data.www-data ~/mywiki
      debian:~# chmod -R ug+rw ~/mywiki
      debian:~# chmod -R o-rwx ~/mywiki

    *

      配置TwistedWeb方式,这里介绍的MoinMoin版本是1.3.1的。
          o

            首先,我们要安装好twisted,安装命令如下:

            debian:~# apt-get install python2.4-twisted python2.4-twisted-bin

          o

            安装完Twisted后,就可以开始配置了。TwistedWeb的MoinMoin配置文件是mointwisted.py,执行文件是mointwisted,这两个文件我们可从模板目录拷贝到实例目录。如:

            debian:~# cp /usr/share/moin/server/mointwisted mointwisted.py ~/mywiki

            用vim等文本编辑器打开mointwisted.py配置文件,需修改两个地方,以指向正确的配置文件路径,修改后的内容如下:

            """
                twisted.web based wiki server

                Run this server with mointwisted script on Linux or Mac OS X, or
                mointwisted.cmd on Windows.
               
                @copyright: 2004-2005 Thomas Waldmann, Oliver Graf, Nir Soffer
                @license: GNU GPL, see COPYING for details.
            """

            # System path configuration

            import sys

            # Path of the directory where wikiconfig.py is located.
            # YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
            #sys.path.insert(0, '/etc/moin')
            sys.path.insert(0,'/root/mywiki')     #修改1:指向你的wikiconfig.py文件所在的目录
            # Path to MoinMoin package, needed if you installed with --prefix=PREFIX
            # or if you did not use setup.py

            # Path to the directory where farmconfig is located (if different).
            #sys.path.insert(0, '/etc/moin')      #修改2:注释掉该行内容,从1.5版开始已默认注释该行

            # Debug mode - show detailed error reports
            ## import os
            ## os.environ['MOIN_DEBUG'] = '1'

            from MoinMoin.server.twistedmoin import TwistedConfig, makeApp
               
               
            class Config(TwistedConfig):
               
                # Server name
                # Used to create .log, .pid and .prof files
                name = 'mointwisted'
               
                # Path to moin shared files (default '/usr/share/moin/wiki/htdocs')
                docs = '/usr/share/moin/htdocs'

                # The server will run with as this user and group (default 'www-data')
                user = 'www-data'                  
                group = 'www-data'

                # Port (default 8080)
                # To serve privileged port under 1024 you will have to run as root
                port = 8080                        

                # Interfaces (default [''])
                # The interfaces the server will listen to.
                # [''] - listen to all interfaces defined on the server
                # ['red.wikicolors.org', 'blue.wikicolors.org'] - listen to some
                # If '' is in the list, other ignored.
                interfaces = ['']

                # How many threads to use (default 10, max 20)
                # The more threads you use, the more memory moin uses. All thread
                # use one CPU, and will not run faster, but might be more responsive
                # on a very busy server.
                threads = 10

                # Set logfile name (default commented)
                # This is the *Apache compatible* log file, not the twisted-style logfile.
                # Leaving this as None will have no Apache compatible log file. Apache
                # compatible logfiles are useful because there are quite a few programs
                # which analyze them and display statistics.
                ## logPath = 'mointwisted.log'

                # Memory profile (default commented)
                # Useful only if you are a developer or interested in moin memory usage
                ## from MoinMoin.util.profile import TwistedProfiler
                ## memoryProfile = TwistedProfiler('mointwisted',
                ##                            requestsPerSample=100,
                ##                            collect=0)

                # Hotshot profile (default commented)
                # Not compatible with threads.
                ## hotshotProfile = name + '.prof'


            # Create the application
            application = makeApp(Config)

[ 本帖最后由 yjnet 于 2006-1-10 16:40 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2005-12-15 08:38 |只看该作者
配置MoinMoin Wiki系统

            Single Wiki的配置文件是wikiconfig.py,位于实例目录下,它默认已可很好工作。它的内容如下:

            # -*- coding: utf-8 -*-                 #为了在MoinMoin中使用中文,请用utf-8编码
            # IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a
            # western country and you don't know that you use utf-8, you probably want to
            # use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode
            # encoding) you MUST use: coding: utf-8
            # That setting must match the encoding your editor uses when you modify the
            # settings below. If it does not, special non-ASCII chars will be wrong.
               
            """
                MoinMoin - Configuration for a single wiki
               
                If you run a single wiki only, you can omit the farmconfig.py config
                file and just use wikiconfig.py - it will be used for every request
                we get in that case.
               
                Note that there are more config options than you'll find in
                the version of this file that is installed by default; see
                the module MoinMoin.multiconfig for a full list of names and their
                default values.
               
                Also, the URL http://moinmoin.wikiwikiweb.de/HelpOnConfiguration has
                a list of config options.
               
                @copyright: 2000-2005 by Juergen Hermann <jh@web.de>
                @license: GNU GPL, see COPYING for details.
            """
               
            from MoinMoin.multiconfig import DefaultConfig

               
            class Config(DefaultConfig):
               
                # Wiki identity ----------------------------------------------------
               
                # Site name, used by default for wiki name-logo [Unicode]
                sitename = u'Untitled Wiki'      #你的WiKi网站的名称
               
                # Wiki logo. You can use an image, text or both. [Unicode]
                # Example: u'<img src="/wiki/mywiki.png" alt="My Wiki">My Wiki'
                # For no logo or text, use ''
                logo_string = sitename           #WiKi的logo
               
                # The interwiki name used in interwiki links
                interwikiname = None
               
               
                # Critical setup  ---------------------------------------------------

                # Misconfiguration here will render your wiki unusable. Check that
                # all directories are accessible by the web server or moin server.
               
                # If you encounter problems, try to set data_dir and data_underlay_dir
                # to absolute paths.
               
                # Where your mutable wiki pages are. You want to make regular
                # backups of this directory.
                data_dir = './data/'
               
                # Where read-only system and help page are. You might want to share
                # this directory between several wikis. When you update MoinMoin,
                # you can safely replace the underlay directory with a new one. This
                # directory is part of MoinMoin distribution, you don't have to
                # backup it.
                data_underlay_dir = './underlay/'

                # This must be '/wiki' for twisted and standalone. For CGI, it should
                # match your Apache Alias setting.
                url_prefix = '/wiki'
               
               
                # Security ----------------------------------------------------------
               
                # Security critical actions (disabled by default)
                # Uncomment to enable options you like.
                allowed_actions = ['DeletePage', 'AttachFile', 'RenamePage']  #允许删除、上传和改名操作,操作受ACL约束。

                # Enable acl (0 to disable)
                acl_enabled = 1                            #开启ACL(访问控制列表)功能

                # IMPORTANT: grant yourself admin rights! replace YourName with
                # your user name. See HelpOnAccessControlLists for more help.
                # All acl_rights_xxx options must use unicode [Unicode]
                acl_rights_before = u"YourName:read,write,delete,revert,admin"   #替换YourName,该用户具有管理员权限。

                # Link spam protection for public wikis (Uncomment to enable)
                # Needs a reliable internet connection.
                #from MoinMoin.util.antispam import SecurityPolicy


                # Mail --------------------------------------------------------------

                # Configure to enable subscribing to pages (disabled by default)
                # or sending forgotten passwords.

                # SMTP server, e.g. "mail.provider.com" (empty or None to disable mail)
                mail_smarthost = ""

                # The return address, e.g "My Wiki <noreply@mywiki.org>"
                mail_from = ""

                # "user pwd" if you need to use SMTP AUTH
                mail_login = ""


                # User interface ----------------------------------------------------

                # Add your wikis important pages at the end. It is not recommended to
                # remove the default links.  Leave room for user links - don't use
                # more than 6 short items.
                # You MUST use Unicode strings here, but you need not use localized
                # page names for system and help pages, those will be used automatically
                # according to the user selected language. [Unicode]
                navi_bar = [                                         #FrontPage中的导航栏,可根据自已需求增减。
                    # Will use page_front_page, (default FrontPage)
                    u'%(page_front_page)s',
                    u'RecentChanges',
                    u'FindPage',
                    u'HelpContents',
                ]

                # The default theme anonymous or new users get
                theme_default = 'modern'                             #默认的页面风格

                # Language options --------------------------------------------------

                # See http://moinmoin.wikiwikiweb.de/ConfigMarket for configuration in
                # YOUR language that other people contributed.

                # The main wiki language, set the direction of the wiki pages
                default_lang = 'zh'                                  #默认语言

                # You must use Unicode strings here [Unicode]        #页面默认正则式,
                page_category_regex = u'^Category[A-Z]'              #以Category字符串开头的页面是分类页面
                page_dict_regex = u'[a-z]Dict$'                      #以Dict字符串结束的页面是字典页面
                page_form_regex = u'[a-z]Form$'                      #以Form字符串结尾的页同是表单页面
                page_group_regex = u'[a-z]Group$'                    #以Group字符串结尾的页面是组页面
                page_template_regex = u'[a-z]Template$'              #以Template字符串结尾的页同是模板页面

                # Content options ---------------------------------------------------

                # Show users hostnames in RecentChanges
                show_hosts = 1

                # Enumerate headlines?
                show_section_numbers = 0

                # Charts size, require gdchart (Set to None to disable).
                chart_options = {'width': 600, 'height': 300}

            完整的配置选项可在MoinMoin/multiconfig.py文件找到,wikiconfig.py中的配置就是继承它的。 multiconfig.py文件里的选项是默认配置,不要去修改它。如果我们要修改这些默认配置,可在wikiconfig.py中重新设置它即可。

            multiconfig.py中默认权限配置选项说明
                +

                  acl_enabled = 1选项配置是否记用ACL,1表示启用,0表示不启用。
                +

                  acl_rights_default = u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write"选项设置了默认的WiKi页面权限。当WiKi页面没有设置ACL是,就统一采用该设置。
                +

                  acl_rights_before = u""选项中的权限设置优先级高于WiKi页面中ACL的设置和上面的默认ACL设置。所以一般在该选项中配置我们MoinMoin系统的管理员。该选项默认在multiconfig.py文件中没有设置。我们要在MoinMoin实例中的wikiconfig.py文件中设置,具体设置请见上同的 wikiconfig.py示例。
                +

                  acl_rights_after = u""选项中的权限设置优先级低于WiKi页面中ACL的设置和上面的默认ACL设置。
                +

                  acl_rights_valid = ['read', 'write', 'delete', 'revert', 'admin']选项列出了可以设置权限。
                +

                  allowed_actions = []选项设置允许的系统定义操作。这些操作有删除页面、页面改名和上传附件等。这些操作的访问权限也会页面的ACL约束。
                +

                  attachments = None选项设置可通过浏览器直接访问附件。如果要设置该选项,请确保上传到Web服务器上的附件不能被执行。设置方法可参考http://moinmoin.wikiwikiweb.de/H ... ion/FileAttachments的内容。
          o

[ 本帖最后由 yjnet 于 2006-1-10 16:41 编辑 ]

论坛徽章:
0
3 [报告]
发表于 2006-01-10 16:43 |只看该作者
#

    *

      启动MoinMoin WiKi服务器

      debian:~/mywiki# ./mointwisted start

      在当前目录会生成一个叫twistd.log的日志文件。如果成功启动,日志文件的内容为:

      2005/12/13 11:48 CST [-] Log opened.
      2005/12/13 11:48 CST [-] twistd 2.0.1 (/usr/bin/python2.4 2.4.2) starting up
      2005/12/13 11:48 CST [-] reactor class: twisted.internet.selectreactor.SelectReactor
      2005/12/13 11:48 CST [-] Loading mointwisted.py...
      2005/12/13 11:48 CST [-] Enabling Multithreading.
      2005/12/13 11:48 CST [-] Loaded.
      2005/12/13 11:48 CST [-] MoinMoin.server.twistedmoin.MoinSite starting on 8080
      2005/12/13 11:48 CST [-] Starting factory <MoinMoin.server.twistedmoin.MoinSite instance at 0xb76004cc>
      2005/12/13 11:48 CST [-] set uid/gid 33/33

      MoinMoin成功启动后,在浏览器上打开http://server_name:8080网址即可访问。停止服务器用stop参数即可。用不带参数的mointwisted命令可以查看命令参数,如:

      debian:~/mywiki# ./mointwisted
      error: nothing to do

      mointwisted - MoinMoin daemon

      usage: mointwisted command

      commands:
        start     start the server
        stop      stop the server
        restart   stop then start the server
        kill      kill the server

      @copyright: 2004-2005 Thomas Waldmann, Nir Soffer
      @license: GNU GPL, see COPYING for details.

#

Apache2+Mod_Python方式,这里我选用了最新的1.5版的MoinMoin软件包。

    *

      第一步要先安装Mod_Python模块,要求使用mod_python 3.1.3或以上版本的Mod_Python模块。安装命令如下:

      debian:~# apt-get install libapache2-mod-python2.3

      下载完软件包后Debian系统会自动进行软件包的配置,回答"Yes"启用Mod_Python模块。这样在 /etc/apache2/mods-enabled目录下会创建一个链接到/etc/apache2/mods- available/mod_python.load文件。该文件配置了装载mod_python模块的语句,如:

      LoadModule python_module /usr/lib/apache2/modules/mod_python.so

    *

      第二步是创建WiKi实例,步骤同上。
    *

      第三步是配置wikiconfig.py,内容如下:

      # -*- coding: utf-8 -*-                         #使用UTF-8编码
      # IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a
      # western country and you don't know that you use utf-8, you probably want to
      # use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode
      # encoding) you MUST use: coding: utf-8
      # That setting must match the encoding your editor uses when you modify the
      # settings below. If it does not, special non-ASCII chars will be wrong.

      """
          MoinMoin - Configuration for a single wiki

          If you run a single wiki only, you can omit the farmconfig.py config
          file and just use wikiconfig.py - it will be used for every request
          we get in that case.

          Note that there are more config options than you'll find in
          the version of this file that is installed by default; see
          the module MoinMoin.multiconfig for a full list of names and their
          default values.

          Also, the URL http://moinmoin.wikiwikiweb.de/HelpOnConfiguration has
          a list of config options.

          ** Please do not use this file for a wiki farm. Use the sample file
          from the wikifarm directory instead! **

          @copyright: 2000-2005 by Juergen Hermann <jh@web.de>
          @license: GNU GPL, see COPYING for details.
      """

      from MoinMoin.multiconfig import DefaultConfig


      class Config(DefaultConfig):

          # Wiki identity ----------------------------------------------------

          # Site name, used by default for wiki name-logo [Unicode]
          sitename = u'Untitled Wiki'                   #你的WiKi网站的名称

          # Wiki logo. You can use an image, text or both. [Unicode]
          # For no logo or text, use '' - the default is to show the sitename.
          # See also url_prefix setting below!
          logo_string = u'<img src="/wiki/common/moinmoin.png" alt="MoinMoin Logo">'    #网站Logo

          # name of entry page / front page [Unicode], choose one of those:

          # a) if most wiki content is in a single language
          #page_front_page = u"MyStartingPage"

          # b) if wiki content is maintained in many languages
          page_front_page = u"FrontPage"                #启用首页

          # The interwiki name used in interwiki links
          #interwikiname = 'UntitledWiki'
          # Show the interwiki name (and link it to page_front_page) in the Theme,
          # nice for farm setups or when your logo does not show the wiki's name.
          #show_interwiki = 1



          # Critical setup  ---------------------------------------------------

          # Misconfiguration here will render your wiki unusable. Check that
          # all directories are accessible by the web server or moin server.

          # If you encounter problems, try to set data_dir and data_underlay_dir
          # to absolute paths.

          # Where your mutable wiki pages are. You want to make regular
          # backups of this directory.
          data_dir = '/root/mywiki/data/'                #设置data目录路径,要用绝对路径

          # Where read-only system and help page are. You might want to share
          # this directory between several wikis. When you update MoinMoin,
          # you can safely replace the underlay directory with a new one. This
          # directory is part of MoinMoin distribution, you don't have to
          # backup it.
          data_underlay_dir = '/root/mywiki/underlay/'   #设置underlay目录路径,要用绝对路径

          # This must be '/wiki' for twisted and standalone. For CGI, it should
          # match your Apache Alias setting.
          url_prefix = '/wiki'                           


          # Security ----------------------------------------------------------

          # This is checked by some rather critical and potentially harmful actions,
          # like despam or PackageInstaller action:
          superuser = [u"moin_admin", ]                  #设置超级用户,1.5版新增选项

          # IMPORTANT: grant yourself admin rights! replace YourName with
          # your user name. See HelpOnAccessControlLists for more help.
          # All acl_rights_xxx options must use unicode [Unicode]
          #acl_rights_before = u"YourName:read,write,delete,revert,admin"   #设置管理权限

          # Link spam protection for public wikis (Uncomment to enable)
          # Needs a reliable internet connection.
          #from MoinMoin.util.antispam import SecurityPolicy


          # Mail --------------------------------------------------------------

          # Configure to enable subscribing to pages (disabled by default)
          # or sending forgotten passwords.

          # SMTP server, e.g. "mail.provider.com" (None to disable mail)
          #mail_smarthost = ""

          # The return address, e.g u"Jürgen Wiki <noreply@mywiki.org>" [Unicode]
          #mail_from = u""

          # "user pwd" if you need to use SMTP AUTH
          #mail_login = ""


          # User interface ----------------------------------------------------

          # Add your wikis important pages at the end. It is not recommended to
          # remove the default links.  Leave room for user links - don't use
          # more than 6 short items.
          # You MUST use Unicode strings here, but you need not use localized
          # page names for system and help pages, those will be used automatically
          # according to the user selected language. [Unicode]
          navi_bar = [                                        #设置导航栏
              # If you want to show your page_front_page here:
              u'%(page_front_page)s',
              u'RecentChanges',
              u'FindPage',
              u'HelpContents',
          ]

          # The default theme anonymous or new users get
          theme_default = 'modern'                            #设置网页格


          # Language options --------------------------------------------------

          # See http://moinmoin.wikiwikiweb.de/ConfigMarket for configuration in
          # YOUR language that other people contributed.

          # The main wiki language, set the direction of the wiki pages
          language_default = 'zh'                             #设置默认语言

          # You must use Unicode strings here [Unicode]
          page_category_regex = u'^Category[A-Z]'
          page_dict_regex = u'[a-z]Dict$'
          page_form_regex = u'[a-z]Form$'
          page_group_regex = u'[a-z]Group$'
          page_template_regex = u'[a-z]Template$'

          # Content options ---------------------------------------------------

          # Show users hostnames in RecentChanges
          show_hosts = 1

          # Enable graphical charts, requires gdchart.
          #chart_options = {'width': 600, 'height': 300}

    *

      第四步是配置在Apache2中配置Mod_Python,在/etc/apache2/conf目录下创建一个moin_mop_python.conf的配置文档,内容如下:

      Alias /wiki/ "/usr/share/moin/htdocs/"

      <Location /mywiki>
        SetHandler python-program
      # Add the path of your wiki directory
        PythonPath "['/root/mywiki/'] + sys.path"
        PythonHandler MoinMoin.request::RequestModPy.run
      </Location>

[ 本帖最后由 yjnet 于 2006-1-10 16:48 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-01-10 16:49 |只看该作者
*
          o

            配置完成后,需重启Apache服务器,查询Apache日志可看到服务器的启动状态,Apache的日志存放在/var/log/apache2目录下。成功启动后,访问http://moinserver/mywiki即可打开进入MoinMoin。
          o

            最后,我们还要安装中文语言包。我们先要在MoinMoin中用登录界面创建一个有管理员权限的用户,在该例中就是moin_admin用户。以该用户登录后再访问http://moinserver/mywiki/SystemPagesSetup网页安装中文语言包。如果你没有管理权限,访问该页面时在语言包前面是不会显示"安装"按钮的。
    *

      访问控制列表(ACL)

      语法:

      #acl [+-]User[,SomeGroup,...]:[right[,right,...]] [[+-]OtherUser:...] [[+-]Trusted:...] [[+-]Known:...] [[+-]All:...] [Default]
      参数说明:
      User      用户名
      SomeGroup 组名
      Trusted   一个特殊组,包括所有通过HTTP-Basic-authentication验证的用户
      Known     一个特殊组,包括所有有效用户 (使用 cookie 验证方法)
      All       一个特殊组,包括所有用户
      Default   一个特殊项,使用配置文件中acl_rights_default中的值
      right     表示权限,可以是 read、write、delete、revert 和 admin的组合,允许为空,表示没有任何权限。

      权限说明:
      read     读权限
      write    编辑权限
      delete   删除页面和附件的权限
      revert   有还原旧版本的权限
      admin    具有管理ACL的权限


      ACL放在网页内容的前面,下面一个ACL示例,所有用户有浏览权限,moin_admin用户具有所有权限:

      #acl moin_admin:read,write,delete,revert,admin All:read

      这是网页正文。
      MoinMoin ACL示例。
      ...

      MoinMoin按ACL设置的顺序匹配用户,一旦匹配就不会搜索后面的配置。如上例,当我以moin_admin用户登录后访问该网页,它匹配了第一个用户名,则MoinMoin的ACL执行过程就停止,不会去再去匹配后面的ACL。所以我们在设置ACL时,应按用户、特殊组、普通组、Known、All的顺序设置。

      在MoinMoin中,组是用网页来维护的,在配置文件中的page_group_regex = u'[a-z]Group$'选项规定,以任意的小写字母组合后接Group结尾命名的页面都是一个组,如:testGroup,网页内每个最高列表项代表一个组成员,下例设置了test1,test2,test3三个用户。:

      #acl moin_admin:read,write,delete,revert,admin All:read
       *test1
       *test2
       *test3
      ...

      在ACL设置中,MoinMoin引入"+"号和"-"号,改变ACL的配置规则,使ACL配置更灵活。当用户请求一个具有"+"或" -"号的ACL的页面时,只在用户名和权限同时匹配时才动作,"+"表示授予权限用户权限,"-"号表示禁止用户的权限,并停止ACL匹配。如果用户名和权限有一个不匹配,则继续搜索下一个ACL项。下面有一个示例:

      #acl SomeUser:read,write SomeGroup:read,write,admin All:read
      可以写成:
      #acl -SomeUser:admin SomeGroup:read,write,admin All:read
      或
      #acl +All:read -SomeUser:admin SomeGroup:read,write,admin

    *

      如果你的系统中安装了4suite这个XML处理软件包,MoinMoin可在线解析XML文档。

      MoinMoin 会根据页面正文第一行是否以<?xml开头来判断是否要启动XML处理。MoinMoin也支持可在线解析DocBook文档,要支持在线解析 DocBook文档,还需安装一个docboot-xsl包,该软件包包含把DocBook格式文档转换成HTML格式文档所需的样式表,安装完成后, HTML样式表位于/usr/share/xml/docbook/stylesheet/nwalsh/html目录。最后,我们需对MoinMoin 进行配置,让它启动XSLT转换功能和指定转换DocBook的样式表目录。启动XSLT转换功能的选项是allow_xslt = 1,默认值为0,表示禁用XSLT转换功能。样式表目录选项为docbook_html_dir,在Debian Sarge中,它的默认值已是正确的啦,为/usr/share/xml/docbook/stylesheet/nwalsh/html/,不用修改。但权限有问题,不能被www-data所访问和修改,我们要用以下命令进行修改。

      debian:/usr/share/xml/docbook/stylesheet# chown -R www-data.www-data nwalsh  

      修改完成后,重启MoinMoin服务器。创建一个DocBook格式的文档,如:

      #format docbook
      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                          "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
                          >
      <book>
        <chapter>
          <title>test</title>
           <para>test</para>
        </chapter>
      </book>

      按保存,MoinMoin会把上面的DocBook文档自动转换成HTML文档输出。注意,DocBoo文档的encoding一定要用utf-8。我是在python2.4环境下做以上测试的,在python2.3中测试不成功,会出现字符编码出错提示。还有一个问题就是不能使用本地的dtd文件,会提示docbookx.dtd文档不存在错误。好象上面示例使用网上的dtd就没问题,但利用网上dtd时,HTML输出速度慢。从上面的测试结果来看,在WiKi中自动转换DocBook还不是很实用,一个是速度问题,上面已说过。另一个是编辑器问题,基于Web的编辑界面大简单了,远远比不上emacs等工具。

有关MoinMoin的使用可参考自带的帮助文档,有很多都是中文版的了,查询起来很方便的。在MoinMoin的官方网站http://moinmoin.wikiwikiweb.de/上也有最新的教材可参考。有关中文化方面,现在的MoinMoin已支持I18n,会根据浏览器的设置自动显示多国语言。中文化支持也有很多志愿者在做,教材和帮助很多都是中文的了。如果你想为MoinMoin的中文化做贡献,请到http://moinmaster.wikiwikiweb.de/注册个帐号,然后把你的帐号放到MoinPagesEditorGroup页面就可以进行翻译了。

小提示:

    *

      任何用户在页面中添加ACL都需要有管理权限(admin)。
    *

      wikiconfig.py配置文档编码需是UTF-8格式的,如果不是UTF-8格式,就不能在该文档中使用中文。我们可用Kwrite编辑器来把它保存成UTF-8格式的。

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
5 [报告]
发表于 2006-01-10 21:45 |只看该作者
不错的说,支持一下Python的应用
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP