179 return |
179 return |
180 |
180 |
181 from .CookieJar import CookieJar |
181 from .CookieJar import CookieJar |
182 |
182 |
183 if rule == CookieJar.Allow: |
183 if rule == CookieJar.Allow: |
184 self.__addHost(host, |
184 self.__addHost( |
185 self.__allowedCookies, self.__blockedCookies, self.__sessionCookies) |
185 host, self.__allowedCookies, self.__blockedCookies, |
|
186 self.__sessionCookies) |
186 return |
187 return |
187 elif rule == CookieJar.Block: |
188 elif rule == CookieJar.Block: |
188 self.__addHost(host, |
189 self.__addHost( |
189 self.__blockedCookies, self.__allowedCookies, self.__sessionCookies) |
190 host, self.__blockedCookies, self.__allowedCookies, |
|
191 self.__sessionCookies) |
190 return |
192 return |
191 elif rule == CookieJar.AllowForSession: |
193 elif rule == CookieJar.AllowForSession: |
192 self.__addHost(host, |
194 self.__addHost( |
193 self.__sessionCookies, self.__allowedCookies, self.__blockedCookies) |
195 host, self.__sessionCookies, self.__allowedCookies, |
|
196 self.__blockedCookies) |
194 return |
197 return |
195 |
198 |
196 def __addHost(self, host, addList, removeList1, removeList2): |
199 def __addHost(self, host, addList, removeList1, removeList2): |
197 """ |
200 """ |
198 Private method to add a host to an exception list. |
201 Private method to add a host to an exception list. |
199 |
202 |
200 @param host name of the host to add (string) |
203 @param host name of the host to add (string) |
201 @param addList reference to the list to add it to (list of strings) |
204 @param addList reference to the list to add it to (list of strings) |
202 @param removeList1 reference to first list to remove it from (list of strings) |
205 @param removeList1 reference to first list to remove it from |
203 @param removeList2 reference to second list to remove it from (list of strings) |
206 (list of strings) |
|
207 @param removeList2 reference to second list to remove it from |
|
208 (list of strings) |
204 """ |
209 """ |
205 if host not in addList: |
210 if host not in addList: |
206 addList.append(host) |
211 addList.append(host) |
207 if host in removeList1: |
212 if host in removeList1: |
208 removeList1.remove(host) |
213 removeList1.remove(host) |