homeworkprod/klaus — comment on commit cb376f953c0002d09d9bdad842a12e1509b73399
File:  line 0
By homeworkprod:

It seems like a hash must be passed to ```dulwich.repo.Repo.__get_item__``` [[1](http://www.samba.org/~jelmer/dulwich/apidocs/dulwich.repo.BaseRepo.html#__getitem__)] or it will raise the following exception. It occurs when a repository's name (which is passed instead) contains a dash (e.g. ``foo-bar.git``), or any other non-hexadecimal character, for that matter.

```pytb
Traceback (most recent call last):
File "../nano/nano.py", line 180, in __call__
retval = callback(environ, **kwargs)
File "../klaus.py", line 64, in wrapper
**callback(env, **kwargs))
File "../klaus.py", line 221, in __init__
self.view()
File "../klaus.py", line 240, in view
refs = [repo[ref] for ref in repo.get_refs()]
File "/var/www/klaus/env/local/lib/python2.7/site-packages/dulwich/repo.py", line 1099, in __getitem__
return self.object_store[name]
File "/var/www/klaus/env/local/lib/python2.7/site-packages/dulwich/object_store.py", line 112, in __getitem__
type_num, uncomp = self.get_raw(sha)
File "/var/www/klaus/env/local/lib/python2.7/site-packages/dulwich/object_store.py", line 300, in get_raw
sha = hex_to_sha(name)
File "/var/www/klaus/env/local/lib/python2.7/site-packages/dulwich/objects.py", line 91, in hex_to_sha
return binascii.unhexlify(hex)
TypeError: Non-hexadecimal digit found
```

(Note that the line numbers given for ```klaus.py``` might be slightly off.)