mo processing test
This commit is contained in:
parent
e14180cbe7
commit
9166790de9
5 changed files with 31 additions and 3 deletions
|
|
@ -6,6 +6,10 @@ from injectable import injectable, autowired, Autowired
|
|||
|
||||
from app.services import Passwords
|
||||
|
||||
class DotTemplate(Template):
|
||||
# Pozwala na kropki w nazwach placeholderów, np. ${user.name.first}
|
||||
idpattern = r'[_a-zA-Z][_a-zA-Z0-9.]*'
|
||||
|
||||
|
||||
@injectable
|
||||
class Mo:
|
||||
|
|
@ -17,7 +21,7 @@ class Mo:
|
|||
raw = ''
|
||||
with open(mo_file, "r") as mo:
|
||||
raw = mo.read()
|
||||
tpl = Template(raw)
|
||||
tpl = DotTemplate(raw)
|
||||
rendered = tpl.substitute(self._passwords.get_values(tpl.get_identifiers()))
|
||||
de_mo_ified = str(mo_file).replace(".mo", "")
|
||||
with open(de_mo_ified, "w") as mo:
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class Passwords:
|
|||
path = key_parts[:-2] if len(key_parts) > 2 else None
|
||||
entry_name = key_parts[-2]
|
||||
field_name = key_parts[-1]
|
||||
kp_entry = self._kp_org.find_entries(path=path, first=True, name=entry_name)[0]
|
||||
output[k] = kp_entry[field_name]
|
||||
kp_entry = self._kp_org.find_entries(path=path, first=True, title=entry_name)[0]
|
||||
output[k] = kp_entry[field_name] # TODO: TypeError: 'Entry' object is not subscriptable
|
||||
return output
|
||||
|
||||
def save(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue