def create_wiki_instance(site_config): try: wiki = DokuWiki(site_config['SITEURL'], site_config['USERNAME'], site_config['PASSWORD'], cookieAuth=True) except KeyError: # 未匹配到mywiki.py配置中的站点 sys.exit('Invalid site.') except DokuWikiError: sys.exit('Username or password is wrong ,can\'t access wiki.') except ModuleNotFoundError: sys.exit('找不到config') else: return wiki
print "Please define a password using " + config_file + " or using the --password option" print "Example of " + config_file +" :" print "["+config_section+"]" print "password=toto" print "username=titi" print "host=example.com" sys.exit(1) print 'Updating ' + args.modulename + '...', # use config file or provided host if config_host is None or args.host is not default_host: config_host = args.host try: wiki = DokuWiki(config_host, config_user, config_password) except DokuWikiError as err: print ' error.' print str(err) sys.exit(1) meta = {'sum':args.message.join(' '), 'minor':True} page_content = args.docfile.read() try: wiki.pages.set(args.modulename, page_content, **meta ) except Exception as e: print ' error.' sys.exit(1) print ' done.'
app_name: str = "MI Rental" admin_email: str = "*****@*****.**" wiki_server: str = "https://wiki.mi.ur.de" wiki_path: str = "lab:ausstattung:" wiki_user: str wiki_pw: str ldap_server: str = "ldaps://ldapauth2.uni-regensburg.de:636" ldap_base_dn: str = "o=uni-regensburg,c=de" ldap_scope: int = ldap.SCOPE_SUBTREE groups_with_edit_rights: List[str] = ["mi-staff.mi.sprachlit.uni-regensburg.de", "mi-shk.mi.sprachlit.uni-regensburg.de"] settings = Settings() app = FastAPI() dw = DokuWiki(settings.wiki_server, settings.wiki_user, settings.wiki_pw, cookieAuth=True) l = ldap.initialize(settings.ldap_server) last_checked_ts = None cache = {} class Item(BaseModel): uid : Optional[int] typ : Optional[List[str]] name: Optional[str] standort: Optional[str] os: Optional[str] zubehoer: Optional[str] seriennummern: Optional[str] status: Optional[str] ausleiher: Optional[str]
app_dir = os.path.dirname(os.path.abspath(__file__)) app = Flask('rhforum', template_folder=app_dir + "/templates") app.config.from_pyfile(app_dir + "/config.py") # XXX BASE_URL = app.config.get("BASE_URL", "") rhforum = Blueprint('rhforum', __name__, template_folder='templates', static_folder='static') doku = None if app.config.get("DOKU_URL", ""): from dokuwiki import DokuWiki try: doku = DokuWiki(app.config['DOKU_URL'], app.config['DOKU_USER'], app.config['DOKU_PASS']) except Exception as ex: print("Failed to connect to DokuWiki: ", ex) class PostForm(Form): text = TextAreaField('Text', [validators.required()]) submit = SubmitField('Odeslat') class EditPostForm(Form): text = TextAreaField('Text', [validators.required()]) submit = SubmitField('Upravit') delete = SubmitField('Smazat')
if not isinstance(loglevel, int): raise ValueError('Invalid log level: %s' % args['log']) logging.basicConfig(level=loglevel, format='[%(levelname)s] %(message)s') del args['log'] for key, val in args.items(): if val is not None: setattr(Config, key, val) if not Config.chroot.endswith('/'): Config.chroot += '/' dw = DokuWiki(Config.url, Config.user, Config.password) class WikiEntry: @property def full_depth(self): return self.depth + len(Config.chroot.split('/')) - 2 @property def full_path(self): """The full path of this entry including chroot.""" return Config.chroot + self.path.rstrip('/') @property def parents_old(self): if self.inode == ROOT_INODE or self.parent.inode == ROOT_INODE:
from flask import Blueprint, Flask, render_template, render_template_string, request, flash, redirect, session, abort, url_for, make_response, g, send_from_directory from dokuwiki import DokuWiki, DokuWikiError from bs4 import BeautifulSoup import rhforum app = Flask('rhweb2') app_dir = os.path.dirname(os.path.abspath(__file__)) app.config.from_pyfile(app_dir + "/config.py") # XXX DOKUUSER = "******" DOKUPASS = open(app_dir + '/DOKUPASS').read().strip() DOKUURL = "https://retroherna.org/wiki" wiki = DokuWiki(DOKUURL, DOKUUSER, DOKUPASS) rhweb = Blueprint('rhweb', __name__, template_folder='templates', static_folder='static') def wikipage(name, force=False): name = name.replace("/", ":") if not force and not g.purge: try: page = open(app_dir + "/cache/" + name + ".html").read() g.caching_comment += "{} read from cache\n".format(name) return page
def __init__(self, url, user, password): self.doku = DokuWiki(url, user, password) self.fd = 0 self._pages = {} self._dirs = {}