Index: /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py	(revision 8320)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py	(revision 8321)
@@ -85,4 +85,5 @@
         self.random_num = random_num
         self.owner = None
+        self.cost = None
         IWorkflowInfo(self).fireTransition('init')
 
@@ -119,11 +120,11 @@
         return self.batch.num
 
-    @property
-    def cost(self):
-        """A float representing the price or ``None``. A read-only attribute.
-        """
-        if self.batch is None:
-            return None
-        return self.batch.cost
+    #@property
+    #def cost(self):
+    #    """A float representing the price or ``None``. A read-only attribute.
+    #    """
+    #    if self.batch is None:
+    #        return None
+    #    return self.batch.cost
 
     @property
@@ -167,5 +168,5 @@
         """
         for num, pin in enumerate(self.getNewRandomNum(num=self.entry_num)):
-            self.addAccessCode(num, pin)
+            self.addAccessCode(num, pin, self.cost)
         return
 
@@ -200,5 +201,5 @@
         return self[ac_id]
 
-    def addAccessCode(self, num, pin, owner=None):
+    def addAccessCode(self, num, pin, cost=0.0, owner=None):
         """Add an access-code.
         """
@@ -206,4 +207,5 @@
         if owner:
             ac.owner = owner
+        ac.cost = cost
         ac.__parent__ = self
         self[ac.representation] = ac
@@ -255,5 +257,5 @@
             )
         writer = csv.writer(open(csv_path, 'w'), quoting=csv.QUOTE_ALL)
-        writer.writerow(['prefix', 'serial', 'ac', 'state', 'history'])
+        writer.writerow(['prefix', 'serial', 'ac', 'state', 'history', 'cost'])
         writer.writerow([self.prefix, '%0.2f' % self.cost, str(self.num),
                          str(self.entry_num)])
@@ -264,5 +266,5 @@
             writer.writerow([
                     self.prefix, value.batch_serial, value.representation,
-                    value.state, value.history
+                    value.state, value.history, value.cost
                     ])
         return os.path.basename(csv_path)
@@ -363,9 +365,12 @@
             pin = row['ac']
             serial = int(row['serial'])
+            try:
+                cost = float(row['cost'])
+            except ValueError:
+                cost = 0.0
             rand_num = pin.rsplit('-', 1)[-1]
-            batch.addAccessCode(serial, rand_num)
+            batch.addAccessCode(serial, rand_num, cost)
             num_entries += 1
         batch.entry_num = num_entries
-
         batch.createCSVLogFile()
         return
Index: /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser.txt
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser.txt	(revision 8320)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser.txt	(revision 8321)
@@ -438,9 +438,9 @@
     ...                             sorted(os.listdir(ac_storage))[-2])
     >>> print open(archive_file, 'rb').read()
-    "prefix","serial","ac","state","history"
+    "prefix","serial","ac","state","history","cost"
     "BLA","19.12","1","3"
-    "BLA","0","BLA-1-<10-DIGITS>","initialized","..."
-    "BLA","1","BLA-1-<10-DIGITS>","initialized","..."
-    "BLA","2","BLA-1-<10-DIGITS>","initialized","..."
+    "BLA","0","BLA-1-<10-DIGITS>","initialized","...","19.12"
+    "BLA","1","BLA-1-<10-DIGITS>","initialized","...","19.12"
+    "BLA","2","BLA-1-<10-DIGITS>","initialized","...","19.12"
 
 Clean up:
Index: /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/interfaces.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/interfaces.py	(revision 8320)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/interfaces.py	(revision 8321)
@@ -40,5 +40,4 @@
     cost = schema.Float(
         title = _(u'Cost of access code'),
-        default = 0.0, min = 0.0,
         )
     state = schema.TextLine(
Index: /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/sample_import.csv
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/sample_import.csv	(revision 8320)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/sample_import.csv	(revision 8321)
@@ -1,5 +1,5 @@
-"prefix","serial","ac","state","history"
-"FOO","9.99","1","0"
-"FOO","0","FOO-1-11111111","used","2011-06-01 12:12:14 - AC initialized by system||2011-06-01 12:14:14 - comment with ""quotes"" by system"
-"FOO","1","FOO-1-22222222","initialized","2011-05-30 21:10:12 - AC initialized by system"
-"FOO","2","FOO-1-33333333","disabled","2012-05-30 21:12:10 - AC initialized by system||2012-05-30 23:10:10 - AC disabled by system"
+"prefix","serial","ac","state","history","cost"
+"FOO","9.99","1","0",""
+"FOO","0","FOO-1-11111111","used","2011-06-01 12:12:14 - AC initialized by system||2011-06-01 12:14:14 - comment with ""quotes"" by system","1000.0"
+"FOO","1","FOO-1-22222222","initialized","2011-05-30 21:10:12 - AC initialized by system",""
+"FOO","2","FOO-1-33333333","disabled","2012-05-30 21:12:10 - AC initialized by system||2012-05-30 23:10:10 - AC disabled by system",""
Index: /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_accesscode.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_accesscode.py	(revision 8320)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_accesscode.py	(revision 8321)
@@ -238,7 +238,9 @@
 
     def test_cost(self):
-        # We get the cost set in batch
+        # The cost of an access code will be stored by handle_batch_added
+        # right after the batch has been added to the ZODB. Thus after
+        # creation of the batch, cost is still 0.0
         cost = self.ac1.cost
-        assert cost == 6.6
+        assert cost == 0.0
 
 class AccessCodeBatchTests(FunctionalTestCase):
@@ -264,4 +266,5 @@
 
         self.ac1 = AccessCode(0, '11111111')
+        self.ac1.cost = 2345.0
         self.ac2 = AccessCode(1, '22222222')
         self.ac3 = AccessCode(2, '33333333')
@@ -298,9 +301,9 @@
         result_path = os.path.join(batch._getStoragePath(), basename)
         expected = '''
-"prefix","serial","ac","state","history"
+"prefix","serial","ac","state","history","cost"
 "FOO","9.99","1","0"
-"FOO","0","FOO-1-11111111","used","<YYYY-MM-DD hh:mm:ss> UTC - ..."
-"FOO","1","FOO-1-22222222","initialized","<YYYY-MM-DD hh:mm:ss> UTC - ..."
-"FOO","2","FOO-1-33333333","disabled","<YYYY-MM-DD hh:mm:ss> UTC - ..."
+"FOO","0","FOO-1-11111111","used","<YYYY-MM-DD hh:mm:ss> UTC - ...","2345.0"
+"FOO","1","FOO-1-22222222","initialized","<YYYY-MM-DD hh:mm:ss> UTC - ...",""
+"FOO","2","FOO-1-33333333","disabled","<YYYY-MM-DD hh:mm:ss> UTC - ...",""
 '''[1:]
         contents = open(result_path, 'rb').read()
@@ -366,4 +369,6 @@
             keys,
             [u'FOO-1-11111111', u'FOO-1-22222222', u'FOO-1-33333333'])
+        # Also cost has been stored correctly
+        self.assertEqual(batch['FOO-1-11111111'].cost,1000.0)
 
     def test_getAccessCode(self):
Index: /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_catalog.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_catalog.py	(revision 8320)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_catalog.py	(revision 8321)
@@ -60,6 +60,4 @@
         self.ac2 = batch.getAccessCode('APP-1-22222222')
         self.ac3 = batch.getAccessCode('APP-1-33333333')
-
-
         return
 
