Merge branch 'master' into stripe

* master:
  Fixing exception on missing param in feed address searching.
  Fixing recommendation date serialization bug.
  Fixing bugs around login with blank password using full password. Also fixing bug in signups with no username.
This commit is contained in:
Samuel Clay 2012-02-28 11:54:32 -08:00
commit 33ad0ea5f6
3 changed files with 8 additions and 5 deletions

View file

@ -33,7 +33,7 @@ class LoginForm(forms.Form):
email_username = User.objects.filter(email=username)
if email_username:
self.user_cache = authenticate(username=email_username[0].username, password=password)
if self.username is None:
if self.user_cache is None:
self.user_cache = authenticate(username=email_username[0].username, password="")
if self.user_cache is None:
# logging.info(" ***> [%s] Bad Login: TRYING JK-LESS PASSWORD" % username)
@ -97,8 +97,8 @@ class SignupForm(forms.Form):
return self.cleaned_data['email']
def clean(self):
username = self.cleaned_data['username']
password = self.cleaned_data['password']
username = self.cleaned_data.get('username', '')
password = self.cleaned_data.get('password', '')
exists = User.objects.filter(username__iexact=username).count()
if exists:
user_auth = authenticate(username=username, password=password)

View file

@ -19,8 +19,11 @@ from utils.view_functions import get_argument_or_404
@json.json_view
def search_feed(request):
address = request.REQUEST['address']
address = request.REQUEST.get('address')
offset = int(request.REQUEST.get('offset', 0))
if not address:
return dict(code=-1, message="Please provide a URL/address.")
feed = Feed.get_feed_from_url(address, create=False, aggressive=True, offset=offset)
if feed:

View file

@ -64,7 +64,7 @@ def json_encode(data, *args, **kwargs):
# see http://code.djangoproject.com/ticket/5868
elif isinstance(data, Promise):
ret = force_unicode(data)
elif isinstance(data, datetime.datetime):
elif isinstance(data, datetime.datetime) or isinstance(data, datetime.date):
ret = str(data)
else:
ret = data