Compare commits
4 Commits
release/0.
...
develop
Author | SHA1 | Date | |
---|---|---|---|
b9e2268f43 | |||
dc3a3b00c6 | |||
b75e12c00c | |||
14bd5e8829 |
@ -1,5 +1,5 @@
|
|||||||
from .api import Config
|
from .api import Config
|
||||||
|
|
||||||
__version__ = "0.4"
|
__version__ = "0.5"
|
||||||
__all__ = ('Config',)
|
__all__ = ('Config',)
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ TYPE = {'boolean': bool,
|
|||||||
'broadcast_address': str,
|
'broadcast_address': str,
|
||||||
'port': str,
|
'port': str,
|
||||||
'domainname': str,
|
'domainname': str,
|
||||||
'date': str}
|
'date': str,
|
||||||
|
'float': float}
|
||||||
|
|
||||||
|
|
||||||
class Option:
|
class Option:
|
||||||
@ -225,13 +226,14 @@ class _Value:
|
|||||||
withwarning: bool=False,
|
withwarning: bool=False,
|
||||||
flatten: bool=False):
|
flatten: bool=False):
|
||||||
ret = {}
|
ret = {}
|
||||||
self._dict_walk(ret,
|
if self.schema:
|
||||||
self.schema,
|
self._dict_walk(ret,
|
||||||
self.path,
|
self.schema,
|
||||||
fullpath,
|
self.path,
|
||||||
withwarning,
|
fullpath,
|
||||||
flatten,
|
withwarning,
|
||||||
None)
|
flatten,
|
||||||
|
None)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
@ -609,9 +611,12 @@ class ContextValue(_Value):
|
|||||||
config: 'Config',
|
config: 'Config',
|
||||||
schema: Dict) -> None:
|
schema: Dict) -> None:
|
||||||
self.config = config
|
self.config = config
|
||||||
first = next(iter(schema.keys()))
|
if schema:
|
||||||
self.path = first.rsplit('.', 1)[0]
|
first = next(iter(schema.keys()))
|
||||||
self.schema = {'properties': schema}
|
self.path = first.rsplit('.', 1)[0]
|
||||||
|
self.schema = {'properties': schema}
|
||||||
|
else:
|
||||||
|
self.schema = {}
|
||||||
|
|
||||||
def __call__(self) -> TiramisuOptionValue:
|
def __call__(self) -> TiramisuOptionValue:
|
||||||
return TiramisuOptionValue(self.config,
|
return TiramisuOptionValue(self.config,
|
||||||
@ -1190,7 +1195,7 @@ class Config:
|
|||||||
value: Any) -> bool:
|
value: Any) -> bool:
|
||||||
if not path in self.form or not 'pattern' in self.form[path]:
|
if not path in self.form or not 'pattern' in self.form[path]:
|
||||||
return True
|
return True
|
||||||
if value is None or value is '':
|
if value is None or value == '':
|
||||||
match = True
|
match = True
|
||||||
else:
|
else:
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
|
Reference in New Issue
Block a user