202 """ |
202 """ |
203 Public method to add an exception rule. |
203 Public method to add an exception rule. |
204 |
204 |
205 @param host name of the host to add a rule for |
205 @param host name of the host to add a rule for |
206 @type str |
206 @type str |
207 @param rule type of rule to add (CookieJar.Allow, CookieJar.Block or |
207 @param rule type of rule to add |
208 CookieJar.AllowForSession) |
208 @type CookieExceptionRuleType |
209 @type int |
209 """ |
210 """ |
210 from .CookieJar import CookieExceptionRuleType |
211 from .CookieJar import CookieJar |
|
212 |
211 |
213 if not host: |
212 if not host: |
214 return |
213 return |
215 |
214 |
216 if rule == CookieJar.Allow: |
215 if rule == CookieExceptionRuleType.Allow: |
217 self.__addHost( |
216 self.__addHost( |
218 host, |
217 host, |
219 self.__allowedCookies, |
218 self.__allowedCookies, |
220 self.__blockedCookies, |
219 self.__blockedCookies, |
221 self.__sessionCookies, |
220 self.__sessionCookies, |
222 ) |
221 ) |
223 return |
222 return |
224 elif rule == CookieJar.Block: |
223 elif rule == CookieExceptionRuleType.Block: |
225 self.__addHost( |
224 self.__addHost( |
226 host, |
225 host, |
227 self.__blockedCookies, |
226 self.__blockedCookies, |
228 self.__allowedCookies, |
227 self.__allowedCookies, |
229 self.__sessionCookies, |
228 self.__sessionCookies, |
230 ) |
229 ) |
231 return |
230 return |
232 elif rule == CookieJar.AllowForSession: |
231 elif rule == CookieExceptionRuleType.AllowForSession: |
233 self.__addHost( |
232 self.__addHost( |
234 host, |
233 host, |
235 self.__sessionCookies, |
234 self.__sessionCookies, |
236 self.__allowedCookies, |
235 self.__allowedCookies, |
237 self.__blockedCookies, |
236 self.__blockedCookies, |