ScriptTool erweitert und Beispiel hinzugefügt

This commit is contained in:
2023-05-06 19:23:20 +02:00
parent 77e472e016
commit d88469e711
5 changed files with 107 additions and 6 deletions

View File

@ -10,9 +10,12 @@ import pathlib
import PyAPplus64
import applus_configs
def main(confFile : pathlib.Path, docDir:str, updateDB:bool) -> None:
def main(confFile : pathlib.Path, updateDB:bool, docDir:str|None = None) -> None:
server = PyAPplus64.applus.applusFromConfigFile(confFile)
if docDir is None:
docDir = str(server.scripttool.getInstallPathWebServer().joinpath("DocLib"))
sql = PyAPplus64.sql_utils.SqlStatementSelect("ARTIKEL");
sql.addFields("ID", "ARTIKEL", "DOCUMENTS");
sql.where.addConditionFieldStringNotEmpty("DOCUMENTS");
@ -28,4 +31,4 @@ def main(confFile : pathlib.Path, docDir:str, updateDB:bool) -> None:
upd.update();
if __name__ == "__main__":
main(applus_configs.serverConfYamlTest, "somedir\\WebServer\\DocLib", False)
main(applus_configs.serverConfYamlTest, False)

52
examples/read_settings.py Normal file
View File

@ -0,0 +1,52 @@
# Copyright (c) 2023 Thomas Tuerk (kontakt@thomas-tuerk.de)
#
# This file is part of PyAPplus64 (see https://www.thomas-tuerk.de/de/pyapplus64).
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
# Einfaches Script, das verschiedene Werte des Servers ausliest.
# Dies sind SysConfig-Einstellungen, aber auch der aktuelle Mandant,
# Systemnamen, ...
import pathlib
import PyAPplus64
import applus_configs
import lxml.etree as ET # type: ignore
def main(confFile : str|pathlib.Path, user:str|None=None, env:str|None=None) -> None:
server = PyAPplus64.applusFromConfigFile(confFile, user=user, env=env)
print ("\n\nSysConf Lookups:")
print (" Default Auftragsart:", server.sysconf.getString("STAMM", "DEFAULTAUFTRAGSART"))
print (" Auftragsarten:")
arten = server.sysconf.getList("STAMM", "AUFTRAGSART", sep='\n')
if not arten: arten = []
for a in arten:
print (" - " + a)
print (" Firmen-Nr. automatisch vergeben:", server.sysconf.getBoolean("STAMM", "FIRMAAUTOMATIK"))
print (" Anzahl Artikelstellen:", server.sysconf.getInt("STAMM", "ARTKLASSIFNRLAENGE"))
print ("\n\nScriptTool:")
print (" CurrentDate:", server.scripttool.getCurrentDate())
print (" CurrentTime:", server.scripttool.getCurrentTime())
print (" CurrentDateTime:", server.scripttool.getCurrentDateTime())
print (" LoginName:", server.scripttool.getLoginName())
print (" UserName:", server.scripttool.getUserName())
print (" UserFullName:", server.scripttool.getUserFullName())
print (" SystemName:", server.scripttool.getSystemName())
print (" Mandant:", server.scripttool.getMandant())
print (" MandantName:", server.scripttool.getMandantName())
print (" InstallPath:", server.scripttool.getInstallPath())
print (" InstallPathAppServer:", server.scripttool.getInstallPathAppServer())
print (" InstallPathWebServer:", server.scripttool.getInstallPathWebServer())
print (" ServerInfo - Version:", server.scripttool.getServerInfo().find("version").text)
if __name__ == "__main__":
main(applus_configs.serverConfYamlTest)