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

remove local iso8601 and use dependency #189

Merged
merged 5 commits into from Sep 15, 2014

Conversation

tisdall
Copy link
Contributor

@tisdall tisdall commented Sep 10, 2014

When running some tests on another project I stumbled upon a failed
test that revealed a bug in colander's iso8601. If you try to
deserialize "2014-09-09T15:15:57.516967" into a datetime object you
get datetime.datetime(2014, 9, 9, 15, 15, 57, 516966) (notice the
microseconds are off by 1). I traced it down to this:

groups["fraction"] = int(float("0.%s" % groups["fraction"]) * 1e6)

int(float("0.%s" % "516967") * 1e6) is equal to 516966 due to
rounding.

I was going to fix it, but iso8601 is a currently maintained project
on pypi that has this issue (and possibly others) already fixed.
So, it makes much more sense to offload everything back to that project.

The only difference (besides the bug fixes) is following:

iso8601.Utc => iso8601.iso8601.Utc
iso8601.FixedOffset => iso8601.iso8601.FixedOffset

An iso8601.py is left for backwards compatibility for strange cases
where colander.iso8601 was imported (like deform).

When running some tests on another project I stumbled upon a failed
test that revealed a bug in colander's iso8601.  If you try to
deserialize "2014-09-09T15:15:57.516967" into a datetime object you
get `datetime.datetime(2014, 9, 9, 15, 15, 57, 516966)` (notice the
microseconds are off by 1).  I traced it down to this:

```
groups["fraction"] = int(float("0.%s" % groups["fraction"]) * 1e6)
```

`int(float("0.%s" % "516967") * 1e6)` is equal to 516966 due to
rounding.

I was going to fix it, but iso8601 is a currently maintained project
on pypi that has this issue (and possibly others) already fixed.
So, it makes much more sense to offload everything back to that project.

The only difference (besides the bug fixes) is following:

`iso8601.Utc` => `iso8601.iso8601.Utc`
`iso8601.FixedOffset` => `iso8601.iso8601.FixedOffset`
@tisdall tisdall changed the title Iso8601 dependency2 remove local iso8601 and use dependency Sep 10, 2014
@tisdall
Copy link
Contributor Author

tisdall commented Sep 10, 2014

Tested in py2.6, py2.7, py3.3, and py3.4 . It needs testing py3.2 and pypy.

deform imports ISO8601_REGEX, so we should make that available too
@mcdonc mcdonc merged commit b354a5b into Pylons:master Sep 15, 2014
@tisdall tisdall deleted the iso8601_dependency2 branch June 4, 2015 19:57
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

Successfully merging this pull request may close these issues.

None yet

2 participants