Thanks! After visiting the first page, the next page still has some of the 
rendering values from the first. I think I'll figure it out though. Thanks 
for the pointer about super()!

On Sunday, August 4, 2013 1:52:54 AM UTC-7, Michael Merickel wrote:
>
> Huh? Where do you describe the error you're seeing??? You should probably 
> be calling __init__ on your parent via super or explicitly but it's not 
> actually a bug since you duplicated the code in both __init__s.
>
>
> On Sun, Aug 4, 2013 at 1:01 AM, John Cadigan 
> <johnpau...@gmail.com<javascript:>
> > wrote:
>
>> I'm trying to implement polymorphic class-based views, but small errors 
>> seem to be popping up at random. Especially as the website runs for a 
>> while. Does it look like I'm taking the right approach to this? In 
>> particular, am I doing the right thing with in the classe's init? Thanks a 
>> ton for the awesome framework!
>>
>>
>> class BaseView(object):
>>     
>>     *def __init__(self,request):
>>         self.request = request
>>         self.response = {}*
>>
>>     def user_info(self, userid):
>>         if userid:
>>             auth_id = DBSession.query(AuthID).filter_by(id=userid).first()
>>             username = auth_id.display_name
>>             user_group = str(auth_id.groups[0])
>>         else:
>>             username = ''
>>             user_group = ''
>>         user_info = {'username':username, 
>> 'group':user_group,'flashcards':flashcards, 'rank': rank}
>>         return user_info
>>
>>     def add_user_info(self):
>>         self.userid = authenticated_userid(self.request)
>>         headers=''
>>         self.response = self.user_info(self.userid)
>>
>> class ContentView(BaseView):
>>     
>> *    def __init__(self, request):
>>         self.request = request
>>         self.response = {}
>>         self.add_user_info()*
>>
>>     @reify
>>     def url(self):
>>         return self.request.matchdict['curl']
>>
>>     def view_classroom(self):
>>         self.response.update(self.add_some_content_method(self.url))
>>         return self.response
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "pylons-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to pylons-devel...@googlegroups.com <javascript:>.
>> To post to this group, send email to pylons...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/pylons-devel.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

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


Reply via email to