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