X-Git-Url: http://www.git.cypherpunks.ru/?p=pyderasn.git;a=blobdiff_plain;f=pyderasn.py;h=8ae9d6e27b8ced4f8de733da94cae4e09b31cfbc;hp=abb5be5fd83f8482d9268295c833a1f5ee3230bb;hb=317317fc2ecfd5fa2305f31701c97be5fbe91d4c;hpb=521a4868199657f49e0b20973dab53730b93fd54 diff --git a/pyderasn.py b/pyderasn.py index abb5be5..8ae9d6e 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -3991,6 +3991,10 @@ class PrintableString(AllowableCharsMixin, CommonString): >>> PrintableString().allowable_chars frozenset([' ', "'", ..., 'z']) + >>> obj = PrintableString("foo*bar", allow_asterisk=True) + PrintableString PrintableString foo*bar + >>> obj.allow_asterisk, obj.allow_ampersand + (True, False) """ __slots__ = () tag_default = tag_encode(19) @@ -4026,6 +4030,18 @@ class PrintableString(AllowableCharsMixin, CommonString): value, bounds, impl, expl, default, optional, _decoded, ) + @property + def allow_asterisk(self): + """Is asterisk character allowed? + """ + return self._asterisk <= self._allowable_chars + + @property + def allow_ampersand(self): + """Is ampersand character allowed? + """ + return self._ampersand <= self._allowable_chars + def _value_sanitize(self, value): value = super(PrintableString, self)._value_sanitize(value) if not frozenset(value) <= self._allowable_chars: @@ -4061,8 +4077,8 @@ class PrintableString(AllowableCharsMixin, CommonString): expl=self._expl if expl is None else expl, default=self.default if default is None else default, optional=self.optional if optional is None else optional, - allow_asterisk=self._asterisk <= self._allowable_chars, - allow_ampersand=self._ampersand <= self._allowable_chars, + allow_asterisk=self.allow_asterisk, + allow_ampersand=self.allow_ampersand, )