frontend package
Submodules
frontend.family module
Created on 2021-01-01
@author: wf
- class frontend.family.LocalWiki(siteName: str, family=None, localSettings: Optional[str] = None)[source]
Bases:
objecta local Wiki
- getLogo() str[source]
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
frontend.server module
Created on 2021-01-06
@author: wf
- class frontend.server.Server(debug=False)[source]
Bases:
JSONAblea 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: str, appWrap=None, debug: bool = False)[source]
enable the given frontend
- Parameters
siteName (str) – the siteName of the frontend to enable
appWrap (appWrap) – optional fb4 Application Wrapper
- Returns
the configured frontend
- Return type
- 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
- getPlatformLogo() str[source]
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
- 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
- sqlDatabaseExist(dburl: str) bool[source]
check if the database with the given name exists
- Parameters
dburl (str) – rfd 1738 formatted database url e.g. mysql://dt_admin:dt2016@localhost:3308/dreamteam_db
- Returns
True if the database exists, else False
- sqlGetDatabaseUrl(dbname: str, username: str, password: str, hostname: Optional[str] = None) str[source]
get the DatabaseUrl for the given database Name
- Parameters
dbname (str) – the name of the database
username (str) – the username
password (str) – the password
- Returns
the url for sqlAlchemy in rfc1738 format e.g. mysql://dt_admin:dt2016@localhost:3308/dreamteam_db
- Return type
str
frontend.site module
Created on 2020-12-31
@author: wf
- class frontend.site.Site(name: str, defaultPage: str = 'Main Page', lang: str = 'en', debug=False)[source]
Bases:
objectmigrated from: https://github.com/BITPlan/com.bitplan.wikifrontend/blob/master/src/main/java/com/bitplan/wikifrontend/Site.java
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:
AppWrapWrapper for Flask Web Application
- adminMenuList(activeItem: Optional[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
- logo(siteName: str) str[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
- 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
frontend.widgets module
frontend.wikicms module
Created on 2020-07-27
@author: wf
- class frontend.wikicms.Frontend(siteName: str, debug: bool = False, filterKeys=None)[source]
Bases:
objectWiki 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
- fixHtml(soup)[source]
fix the HTML in the given soup
- Parameters
soup (BeautifulSoup) – the html parser
- fixNode(node, attribute, prefix, delim=None)[source]
fix the given node
node(BeautifulSoup): the node attribute(str): the name of the attribute e.g. “href”, “src” prefix(str): the prefix to replace e.g. “/”, “/images”, “/thumbs” delim(str): if not None the delimiter for multiple values
- getContent(pagePath: str)[source]
get the content for the given pagePath :param pagePath: the pagePath :type pagePath: str :param whatToFilter: list of filter keys :type whatToFilter: list
- Returns
the HTML content for the given path
- Return type
str
- getFrame(pageTitle)[source]
get the frame template to be used for the given pageTitle#
- Parameters
pageTitle (str) – the pageTitle to get the Property:Frame for
- Returns
the frame or None
- 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(appWrap=None)[source]
open the frontend
- Parameters
appWrap (appWrap) – optional fb4 Application Wrapper
- 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
- render(path: str, **kwargs) str[source]
render the given path
- Parameters
path (str) – the path to render the content for
kwargs() – optional keyword arguments
- Returns
the rendered result
- Return type
str