Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG+2] Added: Allowing optional arguments for scrapy.http.cookies.CookieJar.clear #3231

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scrapy/http/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def _cookies(self):
def clear_session_cookies(self, *args, **kwargs):
return self.jar.clear_session_cookies(*args, **kwargs)

def clear(self):
return self.jar.clear()
def clear(self, domain=None, path=None, name=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about using args/kwargs, like in clear_session_cookies? This way we won't have to change this method if Python decide to change signature for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there're two types of function signatures here:

  • Using args/kwargs, like clear_session_cookies.
  • Using the exact signature of the underlying CookieJar object, like set_cookie and set_policy.

For now I don't think any type has a significant advantage to the other. Thus I'm okay to use either type :) Please let me know if you want me to make the change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I'm fine with merging it as-is.

return self.jar.clear(domain, path, name)

def __iter__(self):
return iter(self.jar)
Expand Down