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

OverflowError: mktime argument out of range #148

Open
xaralis opened this issue Apr 23, 2013 · 2 comments
Open

OverflowError: mktime argument out of range #148

xaralis opened this issue Apr 23, 2013 · 2 comments

Comments

@xaralis
Copy link
Member

xaralis commented Apr 23, 2013

An error is raised when saving publishable object with date which is out of range for mktime. This is however what Ella presets for publishable by default.

See the stack trace:

OverflowError: mktime argument out of range

Traceback (most recent call last):

  File "django/core/handlers/base.py", line 168, in get_response
    receivers = signals.got_request_exception.send(sender=self.__class__, request=request)

  File "ella_newman/options.py", line 203, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)

  File "django/utils/decorators.py", line 99, in _wrapped_view
    raise

  File "django/views/decorators/cache.py", line 79, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)

  File "django/contrib/admin/sites.py", line 197, in inner
    return view(request, *args, **kwargs)

  File "django/db/transaction.py", line 220, in inner
    raise

  File "ella_newman/options.py", line 798, in change_json_view
    context = self.change_view_prepare_context(request, object_id)

  File "ella_newman/options.py", line 762, in change_view_prepare_context
    out = self.change_view_preprocess(request, object_id)

  File "ella_newman/xoptions.py", line 144, in change_view_preprocess
    formsets, form = self.get_change_view_formsets(request, obj)

  File "ella_newman/xoptions.py", line 91, in get_change_view_formsets
    self.save_formset(request, form, formset, change=True)

  File "django/contrib/admin/options.py", line 677, in save_formset
    formset.save()

  File "django/forms/models.py", line 482, in save
    return self.save_existing_objects(commit) + self.save_new_objects(commit)

  File "django/forms/models.py", line 613, in save_new_objects
    self.new_objects.append(self.save_new(form, commit=commit))

  File "django/forms/models.py", line 717, in save_new
    obj.save()

  File "django/db/models/base.py", line 460, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)

  File "django/db/models/base.py", line 570, in save_base
    created=(not record_exists), raw=raw, using=using)

  File "django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)

  File "ella/core/cache/redis.py", line 107, in listing_post_save
    commit=True

  File "ella/core/cache/redis.py", line 307, in add_publishable
    score = repr(to_timestamp(publish_from or now()))

  File "ella/utils/timezone.py", line 38, in to_timestamp
    return time.mktime(dtime.timetuple()) + float(dtime.microsecond)/1000000

dtime is set to: 'datetime.datetime(3000, 1, 1, 0, 0)'

@honzakral
Copy link
Member

I am more inclined to remove the defailt publish_from. It was just a hack to show unpublished publishables in admin and doesn't belong on the core model.

Alternatively set it to datetime.datetime(2100, 1, 1, 0, 0)

@xaralis
Copy link
Member Author

xaralis commented Apr 23, 2013

Yeah, it would suggest setting it to something sane like 2100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants