You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 27, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 27, 2021. It is now read-only.
Django context is really nice, it is a list of maps.
If we need to get a key from this context it just does something like:
for map in reversed(self.dicts)
if key in map:
return map[key]
If we employed this in Role.context and push a new dict to context everytime someone does with Role.using(other_role):, and then pop it afterwards we would have no unneded keys in context, and my problems with passing settings in context from #67 would be solved (since when exiting using we would have erased stuff added to context by used role) .
Another issue it would sove is that we could have problems with implementing sontext managers for owner and modifiers that are nestable.
Hmmm... interesting, I didn't take a deeper look into the impact of this, but it sounds good to me. So I'd recommend you keep the build running under this implementation change, if you want to try it.
An alternative we have, to avoid inadverted mutations between roles, would be to reference the context to a deepcopy of the original context; For example, we could make the "context" name a @ property method, and make it return the current role context.
Activity
diogobaeder commentedon Oct 19, 2012
Hmmm... interesting, I didn't take a deeper look into the impact of this, but it sounds good to me. So I'd recommend you keep the build running under this implementation change, if you want to try it.
An alternative we have, to avoid inadverted mutations between roles, would be to reference the context to a deepcopy of the original context; For example, we could make the "context" name a @ property method, and make it return the current role context.