Skip to content
Snippets Groups Projects
Commit ba3ae7af authored by Eduard Friske's avatar Eduard Friske
Browse files

Umbau attachment_cer auf Konfiguration

parent 7d7f454e
No related branches found
No related tags found
No related merge requests found
...@@ -59,8 +59,8 @@ today = datetime.date.today() ...@@ -59,8 +59,8 @@ today = datetime.date.today()
######## ########
elab_id=643 elab_id=647
cers = ["75552_0001","75553_0001"] # Beispiel: cers = ["75511_0001","75512_0001"] cers = ["75556_0001","75557_0001","75558_0001","75559_0001"] # Beispiel: cers = ["75511_0001","75512_0001"]
TL1_2= "TLA" #### FM1 oder TLA TL1_2= "TLA" #### FM1 oder TLA
year = "2024" year = "2024"
......
...@@ -5,19 +5,19 @@ Created on Fri Jan 6 11:14:44 2023 ...@@ -5,19 +5,19 @@ Created on Fri Jan 6 11:14:44 2023
@author: becker07 @author: becker07
""" """
import pathlib from pathlib import Path
import os import os
import couchdb import couchdb
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing db = couch['vl_db'] # existing
path= Path(config["Pfad"]["Kalibrierschein"])
year = "2024" year = str(config["KS-Daten"]["Jahr"])
cers = ["75552","75553"] # Beispiel: cers = ["75511_0001","75512_0001"] cers = ["75559"] # Beispiel: cers = ["75511_0001","75512_0001"]
#cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"] #cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"]
################### die Kalibrierscheine werden an das cer-json-dokument angehangen ################## ################### die Kalibrierscheine werden an das cer-json-dokument angehangen ##################
...@@ -29,11 +29,11 @@ while i < len(cers): ...@@ -29,11 +29,11 @@ while i < len(cers):
cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf" cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf"
cer_tex= "ks-" +cers[i] + "-" + year + ".tex" cer_tex= "ks-" +cers[i] + "-" + year + ".tex"
print(cer_pdf, cer_tex) print(cer_pdf, cer_tex)
ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf ks_pdf = path.joinpath(cer_pdf)
ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex ks_tex = path.joinpath(cer_tex)
print(ks_pdf, ks_tex) print(ks_pdf, ks_tex)
content_pdf=pathlib.Path(ks_pdf).read_bytes() content_pdf=ks_pdf.read_bytes()
content_tex=pathlib.Path(ks_tex).read_bytes() content_tex=ks_tex.read_bytes()
db.put_attachment(doc, content_pdf, cer_pdf , content_type='application/pdf') db.put_attachment(doc, content_pdf, cer_pdf , content_type='application/pdf')
db.put_attachment(doc, content_tex, cer_tex , content_type='text/plain') db.put_attachment(doc, content_tex, cer_tex , content_type='text/plain')
...@@ -41,6 +41,7 @@ while i < len(cers): ...@@ -41,6 +41,7 @@ while i < len(cers):
################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ################## ################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ##################
exit()
i = 0 i = 0
while i < len(cers): while i < len(cers):
...@@ -53,17 +54,17 @@ while i < len(cers): ...@@ -53,17 +54,17 @@ while i < len(cers):
cer_log= "ks-" +cers[i] + "-" + year + ".log" cer_log= "ks-" +cers[i] + "-" + year + ".log"
cer_gz= "ks-" +cers[i] + "-" + year + ".synctex.gz" cer_gz= "ks-" +cers[i] + "-" + year + ".synctex.gz"
print(cer_pdf, cer_tex) print(cer_pdf, cer_tex)
ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf ks_pdf = path.joinpath(cer_pdf)
ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex ks_tex = path.joinpath(cer_tex)
ks_aux = "C:\\Users\\becker07\\kalibrierschein\\" + cer_aux ks_aux = path.joinpath(cer_aux)
ks_log = "C:\\Users\\becker07\\kalibrierschein\\" + cer_log ks_log = path.joinpath(cer_log)
ks_gz = "C:\\Users\\becker07\\kalibrierschein\\" + cer_gz ks_gz = path.joinpath(cer_gz)
print(ks_pdf, ks_tex) print(ks_pdf, ks_tex)
os.remove(ks_pdf) ks_pdf.unlink(missing_ok= True)
os.remove(ks_tex) ks_tex.unlink(missing_ok= True)
os.remove(ks_aux) ks_aux.unlink(missing_ok= True)
os.remove(ks_log) ks_log.unlink(missing_ok= True)
os.remove(ks_gz) ks_gz.unlink(missing_ok= True)
i += 1 i += 1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment