devartis / passbook

Python library to create Apple Passbook (.pkpass) files
http://www.devartis.com/
MIT License
275 stars 110 forks source link

Updated so you can create pass files in memory. #4

Closed ianlewis closed 12 years ago

ianlewis commented 12 years ago

I updated the API so that it allows for the creation of passbook pass files in memory rather than writing intermediary files to disk.

Writing files to disk in the way it was done previously can be problematic in a multi-threaded or multi-process environment where threads or processes could delete each other's files.

I updated the addFile() method so it takes a file name and a file like object. This was done so that files that were created in memory could be used as well as files that originally had a different file name than the file included in the final zip file.

I updated the create() method so that it returns a file object (By default a StringIO object) that can be read and sent to the browser in an HTTP response. You can override this so that the file gets written to disk or whatever if you like.