Closed XMLSDK closed 11 years ago
If you pass zip_file as a parameter _createZip will write to that file, otherwise it will create a pass.pkpass file. The method could be cleaner with a refactor, but as it is you don't need a return value is you use the zip_file parameter.
The problem is this create
method needs return value of _createZip
:
# Creates the actual .pkpass file
def create(self, certificate, key, wwdr_certificate, password, zip_file=None):
pass_json = self._createPassJson()
manifest = self._createManifest(pass_json)
signature = self._createSignature(manifest, certificate, key, wwdr_certificate, password)
if not zip_file:
zip_file = StringIO()
self.zip_file = self._createZip(pass_json, manifest, signature, zip_file=zip_file)
return zip_file```
I removed the unnecessary assignment. create method expects a parameter if you want to specify the pkpass location, otherwise you can use the returned file buffer.
Should
def _createZip(self, pass_json, manifest, signature, zip_file=None):
returnzf
?Not so sure, since
self.zip_file
is never accessed.