@@ -139,9 +139,7 @@ def create_file_desc(self, project: configparser) -> None:
139139 tei_title .text = project .get ("Project" , "title" , fallback = "untitled letters project" )
140140 random .seed (tei_title .text )
141141 tei_title .set ("xml:id" , self .generate_id ("title" ))
142- editors = ["" ]
143- editors = project .get ("Project" , "editor" ).splitlines ()
144- for entity in editors :
142+ for entity in project .get ("Project" , "editor" , fallback = "" ).splitlines ():
145143 mailbox = parseaddr (entity )
146144 if "@" in entity and any (mailbox ):
147145 tei_editor = SubElement (tei_title_stmt , "editor" )
@@ -156,19 +154,18 @@ def create_file_desc(self, project: configparser) -> None:
156154 SubElement (tei_title_stmt , "editor" )
157155 # publication statement
158156 tei_publication_stmt = self .file_desc .find ("publicationStmt" )
159- publishers = project .get ("Project" , "publisher" ).splitlines ()
160- for entity in publishers :
157+ for entity in project .get ("Project" , "publisher" , fallback = "" ).splitlines ():
161158 SubElement (tei_publication_stmt , "publisher" ).text = entity
162159 if not list (tei_publication_stmt ):
163160 for editor in tei_title_stmt .findall ("editor" ):
164161 SubElement (tei_publication_stmt , "publisher" ).text = editor .text
165162 tei_idno = SubElement (tei_publication_stmt , "idno" )
166163 tei_idno .set ("type" , "url" )
167- tei_idno .text = project .get ("Project" , "fileURL" )
164+ tei_idno .text = project .get ("Project" , "fileURL" , fallback = "www.example.com" )
168165 SubElement (tei_publication_stmt , "date" ).set ("when" , str (datetime .now ().isoformat ()))
169166 availability = SubElement (tei_publication_stmt , "availability" )
170167 tei_licence = SubElement (availability , "licence" )
171- chosen_license = LICENSES .get (project .get ("Project" , "license" ))
168+ chosen_license = LICENSES .get (project .get ("Project" , "license" , fallback = "cc-by" ). lower ( ))
172169 tei_licence .set ("target" , chosen_license .get ("url" ))
173170 tei_licence .text = chosen_license ["text" ]
174171
0 commit comments