Tojaj/createrepo_c — pull request #4 by bochecha (2014-08-08 16:35:19+00:00)
Title: updateinfo: *_date attributes as Python datetime objects

This makes the `UpdateRecord.issued_date` and `UpdateRecord.modified_date` be actual Python datetime objects, rather than plain strings.

A few caveats, on which I'd like feedback/pointers:

1. Internally, the structure still stores strings. That's because I didn't really want to modify the C API, only the Python one. So the getters and setters for these 2 attributes are doing the conversion.

2. The Python header inclusion (`#include `) is obviously wrong. Having never used cmake before, though, I can't seem to figure out how to include the proper header, based on the version of Python detected at build time. :confused:

3. In order to use Python datetime objects in a C extension, it is necessary to use the `PyDateTime_IMPORT` macro first. Currently, I'm calling it in the constructor of the `UpdateRecord` class, which is not necessarily ideal. Where would be the proper place to call it?

Other than that, it makes for a much nicer API:

```
>>> from datetime import datetime
>>> import createrepo_c as cr
>>>
>>> up = cr.UpdateRecord()
>>> up.issued_date = datetime.now()
>>>
>>> up.issued_date
datetime.datetime(2014, 8, 8, 18, 33, 32)
```