1 # (Be in -*- python -*- mode.)
3 # ====================================================================
4 # Copyright (c) 2000-2008 CollabNet. All rights reserved.
6 # This software is licensed as described in the file COPYING, which
7 # you should have received as part of this distribution. The terms
8 # are also available at http://subversion.tigris.org/license-1.html.
9 # If newer versions of this license are posted there, you may use a
10 # newer version instead, at your option.
12 # This software consists of voluntary contributions made by many
13 # individuals. For exact contribution history, see the revision
14 # history and logs, available at http://cvs2svn.tigris.org/.
15 # ====================================================================
17 """This module contains the KeyGenerator class."""
21 """Generate a series of unique keys."""
23 def __init__(self
, first_id
=1):
24 """Initialize a KeyGenerator with the specified FIRST_ID.
26 FIRST_ID should be an int or long, and the generated keys will be
29 self
._key
_base
= first_id
33 """Generate and return a previously-unused key, as an integer."""
35 self
._last
_id
= self
._key
_base
40 def get_last_id(self
):
41 """Return the last id that was generated, as an integer."""