Compare commits

..

No commits in common. "9f18680d6a45499a55dd148e51eb651c16f1cbc9" and "9b6361a5dc70df3e03fdae64be6da60435fd78d2" have entirely different histories.

4 changed files with 13 additions and 35 deletions

View file

@ -1,9 +1,3 @@
## 0.1.0a1 (2025-11-21)
### Fix
- ExtentionError => ExtensionError
## 0.1.0a0 (2025-11-06)
### Feat

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_questionary"
version = "0.1.0a1"
version = "0.1.0a0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data questionary"

View file

@ -1 +1 @@
__version__ = "0.1.0a1"
__version__ = "0.1.0a0"

View file

@ -18,13 +18,12 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
import warnings
from questionary import text, select, confirm, password, Validator, ValidationError, print as qprint
from rougail.tiramisu import CONVERT_OPTION
from rougail.config import RougailConfig
from rougail.error import ExtensionError
from tiramisu.error import ValueOptionError, ValueErrorWarning, ValueWarning
from rougail.error import ExtentionError
from tiramisu.error import ValueOptionError
class RougailUserDataQuestionary:
@ -46,22 +45,15 @@ class RougailUserDataQuestionary:
rougailconfig['step.user_data'] = user_data
user_data = rougailconfig['step.user_data']
if 'questionary' not in user_data:
raise ExtensionError('questionary is not set in step.user_data')
raise ExtentionError('questionary is not set in step.user_data')
self.rougailconfig = rougailconfig
self.errors = []
self.warnings = []
warnings.simplefilter("always", ValueErrorWarning)
warnings.simplefilter("always", ValueWarning)
def run(
self,
) -> None:
# self.config.property.read_write()
if 'demoting_error_warning' not in self.config.property.get():
add_demoting = True
self.config.property.add('demoting_error_warning')
else:
add_demoting = False
self.config.property.read_write()
if self.rougailconfig['questionary.mandatory']:
current_titles = []
while True:
@ -83,14 +75,16 @@ class RougailUserDataQuestionary:
self.display_questionary(mandatory)
else:
self.parse(self.config)
if add_demoting:
self.config.property.remove('demoting_error_warning')
self.config.property.read_only()
return {'errors': [],
'warnings': [],
}
return [
{
"source": 'Questionary',
"errors": self.errors,
"warnings": self.warnings,
"values": [],
"values": values,
}
]
@ -109,9 +103,7 @@ class RougailUserDataQuestionary:
kwargs = {}
option_type = option.information.get('type')
isdefault = option.owner.isdefault()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
default = option.value.get()
default = option.value.get()
ismulti = option.ismulti()
type_obj = None
type_obj = CONVERT_OPTION.get(option_type, {}).get("func")
@ -167,15 +159,7 @@ class RougailValidator(Validator):
value.append(val)
if validate:
try:
with warnings.catch_warnings(record=True) as warns:
self.option.value.set(value)
for warn in warns:
if isinstance(warn.message, ValueErrorWarning):
warn.message.prefix = ''
raise ValidationError(
message=str(warn.message),
cursor_position=len(document),
)
self.option.value.set(value)
except ValueOptionError as err:
err.prefix = ''
raise ValidationError(