Ignore:
Timestamp:
5 Apr 2010, 11:55:28 (15 years ago)
Author:
uli
Message:

Update tests:

  • Check costs
  • Add docs for addAccessCode()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.txt

    r5118 r5122  
    181181      When a code cannot be found :exc:`KeyError` is raised.
    182182
     183   .. method:: addAccessCode(serial_num, random_num)
     184
     185      Add an access code to the batch.
     186
     187      ``serial_num`` denotes the serial number of the new access-code
     188      inside the batch. ``random_num`` is a string of 10 digits unique
     189      in this batch.
     190
    183191   .. method:: invalidate(ac_id[, student_id=None])
    184192
     
    273281    >>> ac.student_id
    274282    'some_user_id'
     283
     284Access codes get their ``cost`` from the batch they belong to. Note,
     285that it is advisable to print costs always using a format, as Python
     286floats are often represented by irritating values:
     287
     288    >>> ac.cost
     289    12.119999999999999
     290
     291    >>> print "%0.2f" % ac.cost
     292    12.12
     293
     294
     295AccessCodeBatchContainer
     296========================
     297
     298.. class:: AccessCodeBatchContainer()
     299
     300   A container for access code batches.
     301
     302   .. method:: addBatch(batch)
     303
     304      Add a batch in this container.
     305
     306   .. method:: getNum(prefix)
     307
     308      Get next unused num for a new batch and a given prefix.
     309
     310      Batches for a given prefix are numerated. Whenever a new batch
     311      is created and other batches inside the container already have
     312      the same prefix, the new one will get the lowest unused number.
    275313
    276314
Note: See TracChangeset for help on using the changeset viewer.