osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting property for current class from property in an different class...


Greetings,

My web scraper program has a top-level class for managing the other 
classes. I went to set up a property for the top-level class that 
changes the corresponding property in a different class.

class Scraper(object):

 ??? def __init__(self, user_id, user_name):
 ??????? self.requestor = Requestor(user_id, user_name)

 ??? @property
 ??? def page_start(self):
 ??????? return self.requestor.page_start

 ??? @page_start.setter
 ??? def page_start(self, number):
 ??????? self.requestor.page_start = number


I get the following error for @page_start.setter when I try to run the code.

 ??? AttributeError: 'Scraper' object has no attribute 'requestor'

That's either a bug or I'm doing it wrong. Or maybe both?

Thank you,

Chris R.