nobrin / macaron

A simple O/R mapper for SQLite
http://nobrin.github.com/macaron/
MIT License
31 stars 8 forks source link

Property names not working properly #20

Closed tyaakow closed 12 years ago

tyaakow commented 12 years ago

When doing automatic assignment, object attributes don't get properly assigned. instead of eg. user.id or user.name, macaron creates user.container_fileid and user.container_filename. Why is that?

nobrin commented 12 years ago

Hi! Thanks trying macaron and comment.

I attemted the situation as following.

The User table was created in test.db as...

CREATE TABLE user (
  id INTEGER PRIMARY KEY,
  name TEXT UNIQUE
);
INSERT INTO user (name) VALUES ('nobrin');

In Python

>>> import macaron
>>> macaron.macaronage("test.db")
>>> class User(macaron.Model): pass
...
>>> user = User.get(1)
>>> user.id
1
>>> user.name
u'nobrin'

It seems to be a proper behavior, I think. Sorry, if I am misunderstanding. Please try it again.

tyaakow commented 12 years ago

When I try your example outside of bottle, it seems to work allright. I have switched to mongodb for the current project I'm doing, but I'll try to recreate the issue again and will get back to you. I really appreciate your prompt response. Thank you for a very cool lib!!