Changeset 34399
- Timestamp:
- 07/12/09 15:04:42 (4 years ago)
- Location:
- lang/python/twopy/tags/0.5.0/twopy
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/python/twopy/tags/0.5.0/twopy/board.py
r34396 r34399 23 23 u = url.endswith("/") and url or url + "/" 24 24 self.__url = u 25 self.__user = user or User.anonymouse()25 self.__user = user or twopy.User.anonymouse() 26 26 self.__isRetrieved = False 27 27 … … 74 74 self.__init_threads() 75 75 76 response = self.user.urlopen(self.subject_url, gzip=False) 76 try: 77 response = self.user.urlopen(self.subject_url, gzip=False) 78 except urllib2.HTTPError, e: 79 return e.code 77 80 if response.code == 200: 78 81 rawdata = unicode(response.read(), 'Shift_JIS', 'ignore') … … 87 90 self.__threads.append(th) 88 91 self.__isRetrieved = True 89 else: raise TypeError 92 93 return response.code 90 94 91 95 def createNewThread(self, subject=u"", name=u"", mailaddr=u"", message=u"", -
lang/python/twopy/tags/0.5.0/twopy/thread.py
r34396 r34399 132 132 self.__isBroken = False 133 133 self.__res = len(self.__comments) 134 return response.code 134 135 135 136 def __appendComments(self, dat): … … 232 233 233 234 def __iter__(self): 234 if not self.isRetrieved: raise NotRetrievedError235 if not self.isRetrieved: raise twopy.NotRetrievedError 235 236 for comment in self.__comments: 236 237 yield comment 237 238 238 239 def __len__(self): 239 if not self.isRetrieved: raise NotRetrievedError240 if not self.isRetrieved: raise twopy.NotRetrievedError 240 241 return len(self.__comments) 241 242 242 243 def __getitem__(self, i): 243 if not self.isRetrieved: raise NotRetrievedError244 if not self.isRetrieved: raise twopy.NotRetrievedError 244 245 return self.__comments[i-1]
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)