[Grok-dev] adaption problem
Toni Mueller
support at oeko.net
Thu Aug 21 10:45:40 EDT 2008
Hi Martijn,
On Thu, 21.08.2008 at 15:19:40 +0200, Martijn Faassen <faassen at startifact.com> wrote:
> I'm trying to understand your description:
> > Part of the project is having a list of members and a list of users.
> > A member should have at most one user account which specifies things
> > like username and password for the given member. For reasons outside of
> > this discussion, these are in a separate table/class.
> >
> > In any case... when I'm viewing the list of members, I'd like to add a
> > user account for a given member.
>
> So you have a button that you can click to get a form to add a new user
> account or something like that?
yes, sort of. I want to click a link to add a user account to an
already-existing member. In the meantime, Uli helped me to solve the
adaption problem.
> You have the id of the member in question. What is "the other table"
> here? The users table?
Yes.
> What are you trying to grab? What model is defined? What do you mean
> with 'importing'?
I am trying to grab an existing user account record and put it into an
'edit' form, if there is such a user account record, and if there
isn't, then I'm going to create one ("add form").
> Unfortunately the version of bzr on my system is too old to access your
I'm using the current version, 1.5.
> What I would do is.. I go to some member's page.
Yes, sort of (you pick one from a list).
> Now I want to create a user account, so I press some button.
Yes.
> There's a form (or there's already enough information) to create a
> new User object (which is a mapped object by SQLAlchemy?).
Yes. There is not enough information to add a new user. At this point,
only the member record which it belongs to, is "known", which I'm going
to use to create a potential user name from.
> The User object will have a foreign key to the Member object, so you
> can do something like myuser.member = themember
Yes. This is to ensure that there are no anonymous users (ie, some that
only have access to stuff, but are otherwise unknown to the
organisation).
> I'm not sure how adaptation is involved here at all yet.
Ok.
That's solved in the meantime, but the problem was that, when I wanted
to create such a user object, I was thinking the wrong way around, and
thus effectively tried to adapt the member's id (integer) to the
interface of the user object, which I couldn't get going. The error
message involved "Could not adapt", so that's why I thought that
adaption was taking place (at least, it "wanted" to).
Thanks for your interest in the problem, though.
Kind regards,
--Toni++
More information about the Grok-dev
mailing list