tutorial assumes format_timezone() returns only offset int, not tuple
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Dulwich |
Fix Released
|
Low
|
Jelmer Vernooij |
Bug Description
When the parse_timezone() function from dulwich.objects is used to generate a value for commit.
Traceback (most recent call last):
File "/usr/lib/
return PrettyPrinter(
File "/usr/lib/
self.
File "/usr/lib/
rep = self._repr(object, context, level - 1)
File "/usr/lib/
self._depth, level)
File "/usr/lib/
return _safe_repr(object, context, maxlevels, level)
File "/usr/lib/
rep = repr(object)
File "/home/
return "<%s %s>" % (self._
File "/home/
return self.sha(
File "/home/
new_
File "/home/
return object_
File "/home/
for chunk in self.as_
File "/home/
self.
File "/home/
self.
File "/home/
if offset % 60 != 0:
TypeError: unsupported operand type(s) for %: 'tuple' and 'int'
This issue can be worked around by using:
commit.
which returns the integer expected by format_timezone()
summary: |
- format_timezone() does not properly handle output of parse_timezone() + tutorial assumes format_timezone() returns only offset int, not tuple |
Changed in dulwich: | |
status: | New → Triaged |
importance: | Undecided → Low |
tags: | added: tutorial |
Changed in dulwich: | |
status: | Fix Committed → Fix Released |
This is intended behaviour, the parse_timezone function is used internally by dulwich to parse timezone fragments and it returns a tuple with a timezone and a boolean indicating whether the timezone parsed was UTC but prefixed with a negative sign ("-").
I've added docstrings to format_timezone and parse_timezone.