Context change for 0.7.0

16 views
Skip to first unread message

Diogo Baeder

unread,
Jun 12, 2013, 1:28:54 AM6/12/13
to pr...@googlegroups.com
Hi guys!

Hey, I was thinking about making a change in the way contexts work; Today, if we enter a role context, and change it, this change is maintained even after the context block is left. For example, the UserRole sets the default user as the user it creates via ensure_user(), which has impact into how other roles will function. What I'd like to do is, instead of keeping the change, just discard it after the script leaves the role context.

For example:
self.context['owner'] = 'foo'
with self.using(UserRole) as role:
    role.ensure_user('bar')
    assert self.context['owner'] == 'bar'
assert self.context['owner'] == 'foo'

What do you think? Does this make sense for you?

Cheers,
__________________________
Diogo Baeder
http://diogobaeder.com.br

Fernando

unread,
Jun 12, 2013, 2:22:23 AM6/12/13
to pr...@googlegroups.com

100% agreed. The new behavior is what I expected it to be.

[]s

Cheers,
__________________________
Diogo Baeder
http://diogobaeder.com.br

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



--
http://about.me/fernandogrd

Bernardo Heynemann

unread,
Jun 12, 2013, 6:12:25 AM6/12/13
to provy
Fine by me as well.

Bernardo Heynemann
Developer @ globo.com

Jacek Bzdak

unread,
Jan 2, 2014, 1:19:45 PM1/2/14
to pr...@googlegroups.com


A step in a good direction.

Jacek Bzdak

unread,
Jan 2, 2014, 1:26:39 PM1/2/14
to pr...@googlegroups.com

I did some work with context lately, and this might be trickier than you'll think.

Some problems:
  • Some cleanup related stuff is stored in context, and you'll have either do clenup when exiting from `using` function or somehow magically make it permanent (or maybe move it out of context).
  • Some things that are in the context can not be deepcopied (I had problems with it today). 

Diogo Baeder

unread,
Jan 2, 2014, 1:51:47 PM1/2/14
to pr...@googlegroups.com
Thanks for the feedback, Jacek, I'll take these into consideration, and try putting them into test cases.

Cheers!

__________________________
Diogo Baeder
http://diogobaeder.com.br


--
Reply all
Reply to author
Forward
0 new messages