[Xotcl] Scripted Value Constraints

Maksym Zinchenko siqsuruq at gmail.com
Sun Feb 18 20:40:34 CET 2024


Hello, I have an issue I can't understand. On my naviserver I have a global
tcl module, inside init.tcl I have defined a scripted value checker for
uuid:

::nx::Slot method type=uuid {name value} {
> set pattern
> {^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$}
> if {![regexp $pattern $value]} {
> error "Value '$value' of parameter $name is not UUID"
> }
> return $value
> }


I have a class definition in like:

::nx::Class create eFaturaClass -superclass ::oodz::baseObj {
> :property {company:object,required}
> :property {uuid:uuid,required}
> :property {doc_type:integer,required}
>
> :method init {} {
> ....
>
}
> ....
> }
>

But when im trying to create an object it gives me an error like:

::eFaturaClass create ef -company ::companyObj -doc_type 1 -uuid  0dbd469a-
> 6669-435e-8a11-621f1b988479
>
> method 'type=uuid' unknown for slot ::eFaturaClass::slot::uuid; valid are: {definition destroy getParameterSpec getPropertyDefinitionOptions onError parameter reconfigure setCheckedInstVar value=add value=delete value=exists value=get v
> alue=set value=unset}
>
>
It looks like I'm doing something wrong, thank you.


More information about the Xotcl mailing list