Private
Public Access
2
0
This commit is contained in:
2026-01-20 17:40:16 +03:00
parent cda556eec6
commit b78da80550
83 changed files with 108 additions and 82 deletions

21
filter_plugins/filters.py Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/python
class FilterModule(object):
def filters(self):
return {
'dict2str': self.dict2str
}
def dict2str(self, d, sep1='=', sep2=';', sep3=''):
return sep2.join(
[ str(k) + (sep1+str(v) if v!=None and v!='' else '') for k, v in d.items() ]
) + sep3
if __name__ == "__main__":
# Tests
filters = FilterModule()
print(filters.filters())
print(filters.dict2str(
{"un": 1, "deux": 2, "str": "a string", "rien": None, "bool": True}
))