pyWikiCMS API Documentation
clickstream
Created on 2023-06-11
@author: wf
ClickStream
dataclass
Represents a clickstream with associated page hits and user agent data.
Source code in frontend/clickstream.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
ClickstreamLog
dataclass
single log of clickstreams
Source code in frontend/clickstream.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
ClickstreamManager
Bases: object
logging of client clicks
Source code in frontend/clickstream.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
|
__init__(root_path, rdf_namespace='http://cms.bitplan.com/clickstream#', show_progress=True, verbose=True)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root_path |
str
|
the root path |
required |
rdf_namespace |
str
|
The base namespace URI for the RDF export. |
'http://cms.bitplan.com/clickstream#'
|
show_progress |
bool
|
If True, show progress. |
True
|
verbose |
bool
|
If True, print the output message. |
True
|
Source code in frontend/clickstream.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
add_stream_properties_to_graph(g, CS, stream, entity_counter)
Adds the properties of a clickstream to the RDF graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
g |
Graph
|
The graph to which the properties will be added. |
required |
CS |
Namespace
|
The namespace for clickstream data. |
required |
stream |
Any
|
The clickstream object containing the data. |
required |
entity_counter |
int
|
A counter for creating unique entities. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The updated entity counter after adding the properties. |
Source code in frontend/clickstream.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
export_to_rdf(rdf_file, batch_size, rdf_format='nt')
Export clickstream logs to RDF files in batches. :param rdf_file: The base file name to write the RDF data to. :param batch_size: The number of clickstream records per file. :param rdf_format: The RDF serialization format to use (default is "nt").
Source code in frontend/clickstream.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
|
get_progress(iterable, desc='Processing')
Wrap an iterable with a progress bar if show_progress is True
Source code in frontend/clickstream.py
189 190 191 192 193 194 195 196 |
|
load_clickstream_logs(limit=None)
Load all clickstream logs from the directory
Source code in frontend/clickstream.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
reload_graph(rdf_file_pattern, rdf_format='nt')
Reloads the RDF data from a batch of files into the clickstream logs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rdf_file_pattern |
str
|
The file pattern to search for RDF files. A wildcard '*' will be appended if not present. |
required |
rdf_format |
str
|
The RDF serialization format of the files (default is "nt"). |
'nt'
|
Returns:
Name | Type | Description |
---|---|---|
Graph |
Graph
|
The RDF graph populated with data from the files. |
Source code in frontend/clickstream.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
|
serialize_batch(g, rdf_file, file_counter, rdf_format)
Serializes a batch of RDF data to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
g |
Graph
|
The RDF graph to serialize. |
required |
rdf_file |
str
|
The base name for the RDF file. |
required |
file_counter |
int
|
The current file count for naming. |
required |
rdf_format |
str
|
The format to serialize the RDF data. |
required |
Source code in frontend/clickstream.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
DateParse
Source code in frontend/clickstream.py
19 20 21 22 23 24 25 26 27 28 29 30 |
|
parse_date(date_str)
staticmethod
Parse a string to a datetime object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date_str |
str
|
The date string to parse. |
required |
Returns:
Name | Type | Description |
---|---|---|
datetime |
datetime
|
The parsed datetime object. |
Source code in frontend/clickstream.py
20 21 22 23 24 25 26 27 28 29 30 |
|
PageHit
dataclass
Represents a single page hit with path and timestamp.
Source code in frontend/clickstream.py
33 34 35 36 37 38 39 40 41 42 43 |
|
UserAgent
dataclass
Represents a user agent with syntax errors, ambiguity and other attributes.
Source code in frontend/clickstream.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
cmsmain
Created on 2022-11-24
@author: wf
CmsMain
Bases: WebserverCmd
ContentManagement System Main Program
Source code in frontend/cmsmain.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
getArgParser(description, version_msg)
override the default argparser call
Source code in frontend/cmsmain.py
19 20 21 22 23 24 25 26 27 |
|
main(argv=None)
main call
Source code in frontend/cmsmain.py
30 31 32 33 34 35 36 |
|
family
Created on 2021-01-01
@author: wf
LocalWiki
Bases: object
a local Wiki
Source code in frontend/family.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
__init__(siteName, family=None, localSettings=None)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
siteName(str) |
the name of the site |
required | |
localSettings(str) |
path to the LocalSettings.php (if any) |
required |
Source code in frontend/family.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
getLogo()
get the local path to the logo file of this wiki
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the logo path if logo is defined as file else None |
Source code in frontend/family.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
getSetting(varName)
get the setting of the given variableName from the LocalSettings.php
Parameters:
Name | Type | Description | Default |
---|---|---|---|
varName(str) |
the name of the variable to return |
required |
Returns: str: the value of the variable
Source code in frontend/family.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
getStatusCode(timeout=0.5)
get the status Code for my url
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout(float) |
the maximum time to wait for a response |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
html statusCode or -1 if there was a timeout |
Source code in frontend/family.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
WikiBackup
Bases: object
find out details about a WikiBackup
potentially this class needs to move upstream to py-3rdparty-MediaWiki
Source code in frontend/family.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
__init__(wikiuser)
constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wikiuser(WikiUser) |
the wikiuser to access this backup |
required |
Source code in frontend/family.py
112 113 114 115 116 117 118 119 120 121 122 123 |
|
exists()
check if this Backup exists
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the self.backupPath directory exists |
Source code in frontend/family.py
125 126 127 128 129 130 131 132 |
|
hasGit()
check if this Backup has a local git repository
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the self.gitPath directory exists |
Source code in frontend/family.py
134 135 136 137 138 139 140 141 |
|
WikiFamily
Bases: object
the wiki family found in the given site dir
Source code in frontend/family.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
__init__(sitedir='/var/www/mediawiki/sites')
constructor Args: sitedir(str): the path to the site definitions see http://wiki.bitplan.com/index.php/Wiki_Family
Source code in frontend/family.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
frame
HtmlFrame
A class to frame html content with a basic HTML document structure.
Attributes:
Name | Type | Description |
---|---|---|
lang |
str
|
Language of the HTML document. |
title |
str
|
Title of the HTML document. |
Source code in frontend/frame.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
__init__(frontend, title, lang='en')
Initialize HtmlFrame with a specified language and title.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
Title for the HTML document. |
required |
lang |
str
|
Language of the HTML document. Defaults to "en". |
'en'
|
Source code in frontend/frame.py
10 11 12 13 14 15 16 17 18 19 20 |
|
footer()
Generate the footer part of the HTML document.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Footer part of an HTML document as a string. |
Source code in frontend/frame.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
frame(content)
Frame the given HTML content with the header and footer of the document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content |
str
|
HTML content to be framed within the HTML structure. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Complete HTML document as a string with the provided content framed. |
Source code in frontend/frame.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
hamburger_menu()
Generate the HTML, CSS, and JavaScript for a hamburger menu.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Hamburger menu HTML, CSS, and JavaScript. |
Source code in frontend/frame.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
header()
Generate the header part of the HTML document.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Header part of an HTML document as a string. |
Source code in frontend/frame.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
html_table
Created on 2022-10-25
@author: wf
HtmlTables
Bases: WebScrape
HtmlTables extractor
Source code in frontend/html_table.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
__init__(url, debug=False, showHtml=False)
Constructor
url(str): the url to read the tables from debug(bool): if True switch on debugging showHtml(bool): if True show the HTML retrieved
Source code in frontend/html_table.py
14 15 16 17 18 19 20 21 22 23 |
|
get_tables(header_tag=None)
get all tables from my soup as a list of list of dicts
Parameters:
Name | Type | Description | Default |
---|---|---|---|
header_tag(str) |
if set search the table name from the given header tag |
required |
Return
dict: the list of list of dicts for all tables
Source code in frontend/html_table.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
server
Created on 2021-01-06
@author: wf
Server
Bases: JSONAble
a server that might serve multiple wikis for a wikiFarm
Source code in frontend/server.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
__init__(debug=False)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storePath(str) |
the path to load my configuration from (if any) |
required |
Source code in frontend/server.py
25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
asHtml(logo_size=64)
render me as HTML code
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logo_size(int) |
the logo_size to applyå |
required |
Source code in frontend/server.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
checkApacheConfiguration(conf, status='enabled')
check the given apache configuration and return an indicator symbol
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conf(str) |
the name of the apache configuration |
required |
Returns:
Type | Description |
---|---|
str
|
a state symbol |
Source code in frontend/server.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
enableFrontend(siteName, appWrap=None, debug=False)
enable the given frontend
Parameters:
Name | Type | Description | Default |
---|---|---|---|
siteName(str) |
the siteName of the frontend to enable |
required | |
appWrap(appWrap) |
optional fb4 Application Wrapper |
required |
Returns: Frontend: the configured frontend
Source code in frontend/server.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
getFrontend(wikiId)
get the frontend for the given wikiid
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wikiId(str) |
the wikiId to get the frontend for |
required |
Returns:
Name | Type | Description |
---|---|---|
Frontend |
the frontend for this wikiId |
Source code in frontend/server.py
176 177 178 179 180 181 182 183 184 185 186 |
|
getPlatformLogo()
get the logo url for the platform this server runs on
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the url of the logo for the current operating system platform |
Source code in frontend/server.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
getStorePath(prefix='serverConfig')
get the path where my store files are located Returns: path to .wikicms in the homedirectory of the current user
Source code in frontend/server.py
201 202 203 204 205 206 207 208 209 210 211 |
|
load()
load my front end configurations
Source code in frontend/server.py
188 189 190 191 192 193 194 195 196 197 198 199 |
|
reinit(debug=False)
reinitialize me
Source code in frontend/server.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
sqlBackupState(dbName)
get the backup state of the given sql backup
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dbName(str) |
the name of the database to check |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
backup State |
Source code in frontend/server.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
sqlBackupStateAsHtml(dbName)
get the backup state of the given sql backup
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dbName(str) |
the name of the database to check |
required |
Returns:
Name | Type | Description |
---|---|---|
html |
backup State html representation |
Source code in frontend/server.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
sqlDatabaseExist(dburl)
check if the database with the given name exists
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dburl(str) |
rfd 1738 formatted database url e.g. mysql://dt_admin:dt2016@localhost:3308/dreamteam_db |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the database exists, else False |
Source code in frontend/server.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
sqlGetDatabaseUrl(dbname, username, password, hostname=None)
get the DatabaseUrl for the given database Name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dbname(str) |
the name of the database |
required | |
username(str) |
the username |
required | |
password(str) |
the password |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the url for sqlAlchemy in rfc1738 format e.g. mysql://dt_admin:dt2016@localhost:3308/dreamteam_db |
Source code in frontend/server.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
stateSymbol(b)
return the symbol for the given boolean state b
Parameters:
Name | Type | Description | Default |
---|---|---|---|
b(bool) |
the state to return a symbol for |
required |
Returns:
Type | Description |
---|---|
str
|
✅ for True and ❌ for false |
Source code in frontend/server.py
239 240 241 242 243 244 245 246 247 248 249 250 |
|
site
Created on 2020-12-31
@author: wf
Site
Bases: object
migrated from: https://github.com/BITPlan/com.bitplan.wikifrontend/blob/master/src/main/java/com/bitplan/wikifrontend/Site.java
Source code in frontend/site.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
__init__(name, defaultPage='Main Page', lang='en', debug=False)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name(str) |
the name of this site |
required | |
defaultPage(str) |
the default Page of this site |
required | |
lang(str) |
the default language of this site |
required | |
debug(bool) |
True if debug info should be given |
required |
Source code in frontend/site.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
configure(config)
configure me from the given configuration Args: config(dict): the configuration to use
Source code in frontend/site.py
32 33 34 35 36 37 38 39 40 |
|
open(ws=None)
open this site
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ws |
Nicegui Webserver |
None
|
Source code in frontend/site.py
42 43 44 45 46 47 48 49 50 51 |
|
version
Created on 2022-12-03
@author: wf
Version
dataclass
Bases: object
Version handling for pyWikiCMS
Source code in frontend/version.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
webscrape
Created on 2020-08-20
@author: wf
WebScrape
Bases: object
WebScraper
Source code in frontend/webscrape.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
__init__(debug=False, showHtml=False)
Constructor
Source code in frontend/webscrape.py
16 17 18 19 20 21 22 23 |
|
getSoup(url, showHtml)
get the beautiful Soup parser
Parameters:
Name | Type | Description | Default |
---|---|---|---|
showHtml(bool) |
True if the html code should be pretty printed and shown |
required |
Source code in frontend/webscrape.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
printPrettyHtml(soup)
print the prettified html for the given soup
Parameters:
Name | Type | Description | Default |
---|---|---|---|
soup(BeuatifulSoup) |
the parsed html to print |
required |
Source code in frontend/webscrape.py
40 41 42 43 44 45 46 47 48 |
|
webserver
Created on 2020-12-30
@author: wf
CmsSolution
Bases: InputWebSolution
Content management solution
Source code in frontend/webserver.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
__init__(webserver, client)
Initialize the solution
Calls the constructor of the base solution Args: webserver (Cms WebServer): The webserver instance associated with this context. client (Client): The client instance this context is associated with.
Source code in frontend/webserver.py
125 126 127 128 129 130 131 132 133 134 135 136 |
|
configure_menu()
configure specific menu entries
Source code in frontend/webserver.py
138 139 140 141 142 143 |
|
home()
async
provide the main content page
Source code in frontend/webserver.py
145 146 147 148 149 150 151 152 153 154 155 156 |
|
CmsWebServer
Bases: InputWebserver
WebServer class that manages the server
Source code in frontend/webserver.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
__init__()
constructor
Source code in frontend/webserver.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
configure_run()
configure command line specific details
Source code in frontend/webserver.py
112 113 114 115 116 117 |
|
enableSites(siteNames)
enable the sites given in the sites list Args: siteNames(list): a list of strings with wikiIds to be enabled
Source code in frontend/webserver.py
100 101 102 103 104 105 106 107 108 109 110 |
|
render_path(frontend_name, page_path)
Renders the content for a specific path of the given frontend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frontend_name |
str
|
The name of the frontend to be rendered. |
required |
page_path |
str
|
The specific path within the frontend to be rendered. |
required |
Returns:
Type | Description |
---|---|
An HTMLResponse containing the rendered page content or an error page if something goes wrong. |
Raises:
Type | Description |
---|---|
SomeException
|
If an error occurs during page content retrieval or rendering. |
Source code in frontend/webserver.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
wikicms
Created on 2020-07-27
@author: wf
Frontend
Bases: object
Wiki Content Management System Frontend
Source code in frontend/wikicms.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
__init__(site_name, parser='lxml', proxy_prefixes=['/images/', '/videos'], debug=False, filterKeys=None)
Constructor Args: site_name(str): the name of the site this frontend is for parser(str): the beautiful soup parser to use e.g. html.parser proxy_prefixes(list): the list of prefixes that need direct proxy access debug: (bool): True if debugging should be on filterKeys: (list): a list of keys for filters to be applied e.g. editsection
Source code in frontend/wikicms.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
checkPath(pagePath)
check the given pathPath
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pagePath |
str
|
the page Path to check |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
None or an error message with the illegal chars being used |
Source code in frontend/wikicms.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
extract_site_and_path(path)
staticmethod
Splits the given path into the site component and the remaining path.
This static method assumes that the 'site' is the first element of the path when split by "/", and the 'path' is the rest of the string after the site.
Parameters: path (str): The complete path to split.
tuple: A tuple where the first element is the site and the second element is the subsequent path.
Source code in frontend/wikicms.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
filter(html)
filter the given html
Source code in frontend/wikicms.py
195 196 197 198 199 |
|
fixHtml(soup)
fix the HTML in the given soup
Parameters:
Name | Type | Description | Default |
---|---|---|---|
soup(BeautifulSoup) |
the html parser |
required |
Source code in frontend/wikicms.py
238 239 240 241 242 243 244 245 246 247 248 249 |
|
fixNode(node, attribute, prefix, delim=None)
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
Source code in frontend/wikicms.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
fix_images_and_videos(soup)
fix image and video entries in the source code
Source code in frontend/wikicms.py
227 228 229 230 231 232 233 234 235 236 |
|
getContent(pagePath)
get the content for the given pagePath Args: pagePath(str): the pagePath whatToFilter(list): list of filter keys Returns: str: the HTML content for the given path
Source code in frontend/wikicms.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
get_cms_pages()
get the Content Management elements for this site
Source code in frontend/wikicms.py
107 108 109 110 111 112 113 114 115 116 117 118 |
|
get_path_response(path)
get the repsonse for the the given path
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path(str) |
the path to render the content for |
required |
Returns:
Name | Type | Description |
---|---|---|
Response |
str
|
a FastAPI response |
Source code in frontend/wikicms.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
log(msg)
log the given message if debugging is true
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg |
str
|
the message to log |
required |
Source code in frontend/wikicms.py
53 54 55 56 57 58 59 60 61 |
|
needsProxy(path)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
the path to check |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if this path needs to be proxied |
Source code in frontend/wikicms.py
163 164 165 166 167 168 169 170 171 172 173 174 |
|
open(ws=None)
open the frontend
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ws |
optional Nicegui webserver |
None
|
Source code in frontend/wikicms.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
proxy(path)
Proxy a request. See https://stackoverflow.com/a/50231825/1497139
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
the path to proxy |
required |
Returns:
Type | Description |
---|---|
str
|
the proxied result as a string |
Source code in frontend/wikicms.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
toReveal(html)
convert the given html to reveal
Source code in frontend/wikicms.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
unwrap(soup)
unwrap the soup
Source code in frontend/wikicms.py
251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
wikiPage(pagePath)
Get the wiki page for the given page path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pagePath |
str
|
The path of the page. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The title of the page. |
Source code in frontend/wikicms.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
wikigrid
Created on 2022-12-03
@author: wf
WikiCheck
A check for a Mediawiki.
Source code in frontend/wikigrid.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
as_checkbox()
Return a checkbox representation of the instance.
Source code in frontend/wikigrid.py
65 66 67 68 69 70 |
|
WikiGrid
A grid of Wikis.
Source code in frontend/wikigrid.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
add_checkboxes()
Add check boxes.
Source code in frontend/wikigrid.py
109 110 111 112 113 114 115 116 117 118 119 120 |
|
check_backup(wiki_state)
Check the backup status for a specific WikiUser.
Source code in frontend/wikigrid.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
check_pages(wiki_state)
Try login for wiki user and report success or failure.
Source code in frontend/wikigrid.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
check_version(wiki_url)
Check the MediaWiki version.
Source code in frontend/wikigrid.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
check_wiki_version(wiki_state)
Check the MediaWiki version for a specific WikiState.
Source code in frontend/wikigrid.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
run_wiki_checks()
perform the selected wiki checks
Source code in frontend/wikigrid.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
WikiState
the state of a wiki
Source code in frontend/wikigrid.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
__init__(row_index, wiki_user)
constructor
Source code in frontend/wikigrid.py
29 30 31 32 33 34 35 |
|