Zotonic 0.x to 1.0 migration

15 views
Skip to first unread message

Alvaro Pagliari

unread,
Jan 9, 2022, 10:12:59 AM1/9/22
to Zotonic users
Hello,

I'm having some trouble adapting my existing models to zotonic 1.0. 
The problem I'm facing is related to this syntax

{% with m.sisbv_auth_utils[{can_auth_vis_for_menu tag="teste"}] as teste %}

From what I could understand, if the model is not listed in the z_model:get_model/2, zotonic uses MQTT to call it. But it cannot convert {can_auth_vis_for_menu,
[{tag,<<"teste">>}]} to binary, so the topic generate an error. 
If I add my module to the z_model:get_model then the error does not occur.

So, my question is:
How can I add my model to the z_module_indexer to stop this problem or how can I tell z_model that I'm passing a tuple?.

The other problem I'm facing is the missing z_converter warning... zotonic_stdlib exists on the _build folder, but not on the apps folder.

Any pointers are welcome! Cheers

--
Álvaro Pagliari

Alvaro Pagliari

unread,
Jan 10, 2022, 5:44:38 AM1/10/22
to Zotonic users
Hello, just found out the problem. The model folder should be named models.

Cheers,

--
Álvaro Pagliari

Marc Worrell

unread,
Jan 13, 2022, 3:12:02 AM1/13/22
to zotoni...@googlegroups.com
Hi,

Was already wondering what was wrong. Good that you found out.

We have also a new template syntax for placing arguments in the payload of the message:

m.modelname.some.path::payload 

The payload can also be a map:

%{ name: value, name2: value2 }

This way you can also call your model, with a payload, from the API and MQTT.

Cheers,

Marc



Sent from my iPhone

On 10 Jan 2022, at 11:44, Alvaro Pagliari <alva...@gmail.com> wrote:

Hello, just found out the problem. The model folder should be named models.
--

---
You received this message because you are subscribed to the Google Groups "Zotonic users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotonic-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zotonic-users/52cbb130-7c82-4416-8fc9-162b79ece2bbn%40googlegroups.com.

Alvaro Pagliari

unread,
Jan 13, 2022, 9:26:33 AM1/13/22
to Zotonic users
Hello Marc!

Thanks for the answer!

m.modelname.some.path::payload 
  I had not found this in the documentation. Was asking myself how it could be done...

By the way, an example of form submit using the new API (without mod_wires) would be awesome! Maybe adapt the comment form on the sample blog site.

Cheers,

--
Álvaro Gianni Pagliari
alvaropag [at] gmail [dot] com


Marc Worrell

unread,
Jan 13, 2022, 10:25:20 AM1/13/22
to 'Marc Worrell' via Zotonic users
On 13 Jan 2022, at 15:26, Alvaro Pagliari <alva...@gmail.com> wrote:

Thanks for the answer!

m.modelname.some.path::payload 
  I had not found this in the documentation. Was asking myself how it could be done...

We are working on all the docs, also for the new docs/zotonic site.

By the way, an example of form submit using the new API (without mod_wires) would be awesome! Maybe adapt the comment form on the sample blog site.

Good idea.

We have to do some experimentation here, as we are not yet feature complete (validations etc).

Cheers! Marc

Reply all
Reply to author
Forward
0 new messages