Yota with Sqlalchemy

17 views
Skip to first unread message

elmcrest

unread,
Jun 11, 2013, 1:21:47 PM6/11/13
to yota-d...@googlegroups.com
Hi Isaac,

i hope your project is far enough for some Beginners :)

If you like to support me I would be thankful - i'm sad that i can, at the moment, only deliver bug reports and be kind of annoying... i'm relatively new to python and flask.

anyway what i got working for me so far is a simple flask app with the "foundation 4" framework ... that runs really good so far.

I also got a version running with WTForms which populates forms from SQLAlchemy and saves them into the DB. But I Struggled with rendering the Forms the way i need them for Foundation.

The Features from Yota mentioned in the Docs are really compelling - so i'd really like to use your Project.

Long story, short question:

Can you maybe give me a small Example of how to integrate Yota with SQLAlchemy - in particular i would need a basic_form with support for "standard fields" (Int, String) and a Select Field.


Thx in advance,
Marius


icook

unread,
Jun 11, 2013, 1:51:27 PM6/11/13
to yota-d...@googlegroups.com
elmcrest,

It should be good for beginners, with the exception of my still spotty documentation.

Don't worry about bug reports being annoying, worst case it won't be a bug and I'll just close it, no harm done. I'd rather the project be more stable. :)

It's definitely true that Yota is very young, and things will be shifting around a lot. For instance you mention a standard Int field. Well currently, there is no integer validator. These things will come with time, but what I'm trying to say is if you're trying to build something for production you may want to wait a few releases. However, if you're just learning then working in a young codebase can help you learn a lot.

Also keep in mind that my development cycle is going code first, documentation second. Right now updates are rolling out fast and the documentation is falling behind. There will be significant changes to the AJAX inner workings in 0.1.6, however 0.1.7 will update all the docs and expand the examples.

Here's a simple example, there may be a few typos in it but hopefully you get the idea. Let me know if you have any questions.

elmcrest

unread,
Jun 11, 2013, 4:33:13 PM6/11/13
to yota-d...@googlegroups.com
hi icook,

thx for your fast reply. i think i'll give it a try and see how far i come with yota :)

however here is what I have, sadly with a AttributeError:


are you somewhere around in IRC?

I can maybe do some documentation work when i understood the thing ... It's just if you help me, I help you ... if I can ;)

Thx in advance
elmcrest

icook

unread,
Jun 11, 2013, 4:57:37 PM6/11/13
to yota-d...@googlegroups.com
Ah, I've got it. It was definitely a tricky one, so I'm glad you brought it up so I can try and put something to prevent people in the future from doing this.

Basically in Yota your Form class holds all of the Nodes it contains in two different ways. 1: it has a list of nodes internally that maintains order. 2: it uses attributes of the form (which are just a dictionary. See __dict__ for more info) for faster lookup time. However, the Form contains more attributes that just Nodes. In this instance, the attribute "name" is actually used to hold a name for your form. As such it overwrote the "name" attribute that referenced the Node. So, when your validator tried to run it couldn't find the Node, and just returned None, thus the error. NoneType is not a Node, so no resolve_data.

tldr; just change the attribute "name" to something else. Hope this helps.

icook

unread,
Jun 11, 2013, 5:23:11 PM6/11/13
to yota-d...@googlegroups.com
And in my rush to answer I forgot to mention; no, I am not on IRC. Admittedly don't have much experience with it. If you had a good channel to suggest tho I might try and log in from time to time.
Reply all
Reply to author
Forward
0 new messages