Mike,

It took a few hours to wrap my head around your work and adapt it to my 
actual use case, but it's working great now...except for a particular case 
when used with templates.

Basically, I'm querying for relevant courses and then iterating over the 
results to construct a form for grade entry, similar to this:

% for course in courses:
    <label>${course}</label>
    <input name="${course}" value="${user.courses[course]}"/>
% endfor

This works well when I've already created a record linking a student and 
course in the 'user_courses' association table (i.e., 
user.courses['somecourse'] exists), but I can't use this construct *in my 
template* to set a grade for a course that I haven't already associated 
with the student (because user.courses['newcourse'] doesn't at the time the 
user object is passed to Mako).

This is precisely the scenario you used for testing, so I know it's not an 
issue with the SQLAlchemy schema. Hard-coding it works, also (i.e. in the 
controller, setting user.courses['newcourse'] to the value captured from a 
form submission).

How would you recommend tackling this? Should it be addressed in the 
controller, the template, or perhaps in the schema (__init__ or a 
listener?)?

Thanks again.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to