validate name in symlinkoption
This commit is contained in:
@ -299,7 +299,7 @@ class Base:
|
||||
_setattr(self, '_extra', tuple([tuple(extra.keys()), tuple(extra.values())]))
|
||||
|
||||
def impl_is_readonly(self) -> str:
|
||||
# _path is None when initialise SymlinkOption
|
||||
# _path is None when initialise SymLinkOption
|
||||
return hasattr(self, '_path') and self._path is not None
|
||||
|
||||
def impl_getproperties(self) -> FrozenSet[str]:
|
||||
|
@ -19,7 +19,7 @@
|
||||
# the whole pypy projet is under MIT licence
|
||||
# ____________________________________________________________
|
||||
from typing import Any
|
||||
from .baseoption import BaseOption
|
||||
from .baseoption import BaseOption, valid_name
|
||||
from ..i18n import _
|
||||
|
||||
|
||||
@ -29,6 +29,8 @@ class SymLinkOption(BaseOption):
|
||||
def __init__(self,
|
||||
name: str,
|
||||
opt: BaseOption) -> None:
|
||||
if not valid_name(name):
|
||||
raise ValueError(_('"{0}" is an invalid name for an option').format(name))
|
||||
if not isinstance(opt, BaseOption) or \
|
||||
opt.impl_is_optiondescription() or \
|
||||
opt.impl_is_symlinkoption():
|
||||
|
Reference in New Issue
Block a user