frontend package

Submodules

frontend.family module

Created on 2021-01-01

@author: wf

class frontend.family.LocalWiki(siteName: str, family=None, localSettings: str = None)[source]

Bases: object

a local Wiki

get the local path to the logo file of this wiki

Returns

the logo path if logo is defined as file else None

Return type

str

getSetting(varName: str) → str[source]

get the setting of the given variableName from the LocalSettings.php

Parameters

varName (str) – the name of the variable to return

Returns

the value of the variable

Return type

str

getStatusCode(timeout=0.2)[source]

get the status Code for my url

Parameters

timeout (float) – the maximum time to wait for a response

Returns

html statusCode or -1 if there was a timeout

Return type

int

class frontend.family.WikiFamily(sitedir: str = '/var/www/mediawiki/sites')[source]

Bases: object

the wiki family found in the given site dir

frontend.server module

Created on 2021-01-06

@author: wf

class frontend.server.Server[source]

Bases: lodstorage.jsonable.JSONAble

a server that might serve multiple wikis for a wikiFarm

checkApacheConfiguration(conf, status='enabled') → str[source]

check the given apache configuration and return an indicator symbol

Parameters

conf (str) – the name of the apache configuration

Returns

a state symbol

enableFrontend(siteName)[source]

enable the given frontend

Parameters

siteName (str) – the siteName of the frontend to enable

Returns

the configured frontend

Return type

Frontend

getFrontend(wikiId)[source]

get the frontend for the given wikiid

Parameters

wikiId (str) – the wikiId to get the frontend for

Returns

the frontend for this wikiId

Return type

Frontend

get the logo url for the platform this server runs on

Returns

the url of the logo for the current operating system platform

Return type

str

getStorePath(prefix: str = 'serverConfig') → str[source]

get the path where my store files are located :returns: path to .wikicms in the homedirectory of the current user

homePath = None
load()[source]

load my front end configurations

reinit()[source]

reinitialize me

render()[source]

render me

sqlBackupState(dbName)[source]

get the backup state of the given sql backup

Parameters

dbName (str) – the name of the database to check

Returns

backup State

Return type

dict

sqlBackupStateAsHtml(dbName)[source]

get the backup state of the given sql backup

Parameters

dbName (str) – the name of the database to check

Returns

backup State html representation

Return type

html

stateSymbol(b: bool) → str[source]

return the symbol for the given boolean state b

Parameters

b (bool) – the state to return a symbol for

Returns

✅ for True and ❌ for false

store()[source]

frontend.site module

Created on 2020-12-31

@author: wf

class frontend.site.Site(name: str, defaultPage: str = 'Main Page', lang: str = 'en')[source]

Bases: object

migrated from: https://github.com/BITPlan/com.bitplan.wikifrontend/blob/master/src/main/java/com/bitplan/wikifrontend/Site.java

configure(config: dict)[source]

configure me from the given configuration :param config: the configuration to use :type config: dict

frontend.webserver module

Created on 2020-12-30

@author: wf

class frontend.webserver.WikiCMSWeb(host='0.0.0.0', port=8251, debug=False)[source]

Bases: fb4.app.AppWrap

Wrapper for Flask Web Application

adminMenuList(activeItem: str = None)[source]

get the list of menu items for the admin menu :param activeItem: the active menu item :type activeItem: str

Returns

the list of menu items

Return type

list

enableSites(siteNames)[source]

enable the sites given in the sites list :param siteNames: a list of strings with wikiIds to be enabled :type siteNames: list

family() → str[source]

show a html representation of the family of wikis on this server (if any)

Returns

a html table of all wikis in the family

Return type

str

frontends() → str[source]

render the frontends view

Returns

the html for the admin view

Return type

str

render the Logo for the given siteName

Parameters

siteName (str) – the name of the site e.g. wiki.bitplan.com

Returns

the rendered Logo for the given Site

static splitPath(path)[source]

split the given path :param path: the path to split :type path: str

Returns

the site of the path an the actual path

Return type

str,str

wikis() → str[source]

render the wikis table

Returns

the html code for the table of wikis

Return type

str

wrap(siteName, path)[source]

wrap the given path for the given site :param siteName: the name of the site to wrap :type siteName: str :param path: the path to wrap :type path: path

frontend.webserver.family()[source]
frontend.webserver.frontends()[source]
frontend.webserver.root()[source]

render the Logo for the given siteName

Parameters

siteName (str) – the name of the site e.g. wiki.bitplan.com

Returns

the rendered Logo for the given Site

frontend.webserver.wikis()[source]
frontend.webserver.wrap(path)[source]

wrap the url request for the given path

Parameters

path (str) – the path to wrap - the path should start with /<wikiId>/ followed by the actual path in the wiki

frontend.widgets module

Created on 2021-01-04

@author: wf

class frontend.widgets.Image(url, alt=None, width=None, height=None)[source]

Bases: frontend.widgets.Widget

a HTML Image

render()[source]

render me

Returns

html code for Image

Return type

str

Bases: frontend.widgets.Widget

a HTML link

render()[source]
class frontend.widgets.MenuItem(url: str, title: str, active: bool = False)[source]

Bases: frontend.widgets.Widget

a menu item

render()[source]

render me

Returns

html code for MenuItem

Return type

str

class frontend.widgets.Widget[source]

Bases: object

a HTML widget

frontend.wikicms module

Created on 2020-07-27

@author: wf

class frontend.wikicms.Frontend(siteName: str, debug: bool = False)[source]

Bases: object

Wiki Content Management System Frontend

checkPath(pagePath)[source]

check the given pathPath

Parameters

pagePath (str) – the page Path to check

Returns

None or an error message with the illegal chars being used

Return type

str

errMsg(ex)[source]
getContent(pagePath: str)[source]

get the content for the given pagePath :param pagePath: the page Pageh :type pagePath: str

Returns

the HTML content for the given path

Return type

str

log(msg)[source]

log the given message if debugging is true

Parameters

msg (str) – the message to log

needsProxy(path: str) → bool[source]
Parameters

path (str) – the path to check

Returns

True if this path needs to be proxied

open()[source]

open the frontend

proxy(path: str) → str[source]

proxy a request see https://stackoverflow.com/a/50231825/1497139

Parameters

path (str) – the path to proxy

Returns

the proxied result Request

wikiPage(pagePath)[source]

get the wikiPage for the given pagePath

Parameters

pagePath (str) – the page path

Returns

the pageTitle

Return type

str

Module contents