We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Downloading store in a zip file with no revision lacks revision headers
not sure if this is a dupe or related to other PO-headers bugs - but it seems like stores with no unit revision dont get headers - this causes re-uploading to fail

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pootle/apps/pootle_store/store/serialize.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) Pootle contributors.
4 #
5 # This file is a part of the Pootle project. It is distributed under the GPL3
6 # or later license. See the LICENSE file for a copy of the license and the
7 # AUTHORS file for copyright and authorship information.
8 
9 from django.core.cache import caches
10 from django.utils.functional import cached_property
11 
12 from pootle.core.delegate import config, serializers
13 
14 
15 class StoreSerialization(object):
16     """Calls configured deserializers for Store"""
17 
18     def __init__(self, store):
19         self.store = store
20 
21     @property
22     def project_serializers(self):
23         project = self.store.translation_project.project
24         return (
25             config.get(
26                 project.__class__,
27                 instance=project,
28                 key="pootle.core.serializers")
29             or [])
30 
31     @property
32     def pootle_path(self):
33         return self.store.pootle_path
34 
35     @cached_property
36     def max_unit_revision(self):
37         return self.store.data.max_unit_revision
38 
39     @cached_property
40     def serializers(self):
41         available_serializers = serializers.gather(
42             self.store.translation_project.project.__class__)
43         found_serializers = []
44         for serializer in self.project_serializers:
45             found_serializers.append(available_serializers[serializer])
46         return found_serializers
47 
48     def tostring(self):
49         store = self.store.syncer.convert()
50         if hasattr(store, "updateheader"):
51             # FIXME We need those headers on import
52             # However some formats just don't support setting metadata
53             store.updateheader(add=True, X_Pootle_Path=self.pootle_path)
54             store.updateheader(add=True, X_Pootle_Revision=self.max_unit_revision)
55         return str(store)
56 
57     def pipeline(self, data):
58         if not self.serializers:
59             return data
60         for serializer in self.serializers:
61             data = serializer(self.store, data).output
62         return data
63 
64     def serialize(self):
65         cache = caches["exports"]
66         ret = cache.get(
67             self.pootle_path,
68             version=self.max_unit_revision)
69         if not ret:
70             ret = self.pipeline(self.tostring())
71             cache.set(
72                 self.pootle_path,
73                 ret,
74                 version=self.max_unit_revision)
75         return ret
76
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pootle/apps/pootle_store/store/serialize.py b/pootle/apps/pootle_store/store/serialize.py
--- a/pootle/apps/pootle_store/store/serialize.py
+++ b/pootle/apps/pootle_store/store/serialize.py
@@ -50,8 +50,9 @@
         if hasattr(store, "updateheader"):
             # FIXME We need those headers on import
             # However some formats just don't support setting metadata
+            max_unit_revision = self.max_unit_revision or 0
             store.updateheader(add=True, X_Pootle_Path=self.pootle_path)
-            store.updateheader(add=True, X_Pootle_Revision=self.max_unit_revision)
+            store.updateheader(add=True, X_Pootle_Revision=max_unit_revision)
         return str(store)
 
     def pipeline(self, data):

{"golden_diff": "diff --git a/pootle/apps/pootle_store/store/serialize.py b/pootle/apps/pootle_store/store/serialize.py\n--- a/pootle/apps/pootle_store/store/serialize.py\n+++ b/pootle/apps/pootle_store/store/serialize.py\n@@ -50,8 +50,9 @@\n         if hasattr(store, \"updateheader\"):\n             # FIXME We need those headers on import\n             # However some formats just don't support setting metadata\n+            max_unit_revision = self.max_unit_revision or 0\n             store.updateheader(add=True, X_Pootle_Path=self.pootle_path)\n-            store.updateheader(add=True, X_Pootle_Revision=self.max_unit_revision)\n+            store.updateheader(add=True, X_Pootle_Revision=max_unit_revision)\n         return str(store)\n \n     def pipeline(self, data):\n", "issue": "Downloading store in a zip file with no revision lacks revision headers\nnot sure if this is a dupe or related to other PO-headers bugs - but it seems like stores with no unit revision dont get headers - this causes re-uploading to fail\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom django.core.cache import caches\nfrom django.utils.functional import cached_property\n\nfrom pootle.core.delegate import config, serializers\n\n\nclass StoreSerialization(object):\n    \"\"\"Calls configured deserializers for Store\"\"\"\n\n    def __init__(self, store):\n        self.store = store\n\n    @property\n    def project_serializers(self):\n        project = self.store.translation_project.project\n        return (\n            config.get(\n                project.__class__,\n                instance=project,\n                key=\"pootle.core.serializers\")\n            or [])\n\n    @property\n    def pootle_path(self):\n        return self.store.pootle_path\n\n    @cached_property\n    def max_unit_revision(self):\n        return self.store.data.max_unit_revision\n\n    @cached_property\n    def serializers(self):\n        available_serializers = serializers.gather(\n            self.store.translation_project.project.__class__)\n        found_serializers = []\n        for serializer in self.project_serializers:\n            found_serializers.append(available_serializers[serializer])\n        return found_serializers\n\n    def tostring(self):\n        store = self.store.syncer.convert()\n        if hasattr(store, \"updateheader\"):\n            # FIXME We need those headers on import\n            # However some formats just don't support setting metadata\n            store.updateheader(add=True, X_Pootle_Path=self.pootle_path)\n            store.updateheader(add=True, X_Pootle_Revision=self.max_unit_revision)\n        return str(store)\n\n    def pipeline(self, data):\n        if not self.serializers:\n            return data\n        for serializer in self.serializers:\n            data = serializer(self.store, data).output\n        return data\n\n    def serialize(self):\n        cache = caches[\"exports\"]\n        ret = cache.get(\n            self.pootle_path,\n            version=self.max_unit_revision)\n        if not ret:\n            ret = self.pipeline(self.tostring())\n            cache.set(\n                self.pootle_path,\n                ret,\n                version=self.max_unit_revision)\n        return ret\n", "path": "pootle/apps/pootle_store/store/serialize.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom django.core.cache import caches\nfrom django.utils.functional import cached_property\n\nfrom pootle.core.delegate import config, serializers\n\n\nclass StoreSerialization(object):\n    \"\"\"Calls configured deserializers for Store\"\"\"\n\n    def __init__(self, store):\n        self.store = store\n\n    @property\n    def project_serializers(self):\n        project = self.store.translation_project.project\n        return (\n            config.get(\n                project.__class__,\n                instance=project,\n                key=\"pootle.core.serializers\")\n            or [])\n\n    @property\n    def pootle_path(self):\n        return self.store.pootle_path\n\n    @cached_property\n    def max_unit_revision(self):\n        return self.store.data.max_unit_revision\n\n    @cached_property\n    def serializers(self):\n        available_serializers = serializers.gather(\n            self.store.translation_project.project.__class__)\n        found_serializers = []\n        for serializer in self.project_serializers:\n            found_serializers.append(available_serializers[serializer])\n        return found_serializers\n\n    def tostring(self):\n        store = self.store.syncer.convert()\n        if hasattr(store, \"updateheader\"):\n            # FIXME We need those headers on import\n            # However some formats just don't support setting metadata\n            max_unit_revision = self.max_unit_revision or 0\n            store.updateheader(add=True, X_Pootle_Path=self.pootle_path)\n            store.updateheader(add=True, X_Pootle_Revision=max_unit_revision)\n        return str(store)\n\n    def pipeline(self, data):\n        if not self.serializers:\n            return data\n        for serializer in self.serializers:\n            data = serializer(self.store, data).output\n        return data\n\n    def serialize(self):\n        cache = caches[\"exports\"]\n        ret = cache.get(\n            self.pootle_path,\n            version=self.max_unit_revision)\n        if not ret:\n            ret = self.pipeline(self.tostring())\n            cache.set(\n                self.pootle_path,\n                ret,\n                version=self.max_unit_revision)\n        return ret\n", "path": "pootle/apps/pootle_store/store/serialize.py"}]}