Ignore:
Timestamp:
16 Aug 2010, 12:32:26 (14 years ago)
Author:
uli
Message:

Move 'get_access_code' to the accesscodes subpackage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/jambtables/util.py

    r5445 r5447  
    4545    # XXX: Maybe we have to mark reg_no as used here?
    4646    return (applicant_data, entries[0])
    47 
    48 def get_access_code(access_code):
    49     """Get an access code instance.
    50 
    51     Returns ``None`` if the given code cannot be found.
    52 
    53     XXX: This should be moved to `accesscodes` as public API part.
    54     """
    55     site = grok.getSite()
    56     if not isinstance(access_code, basestring):
    57         return None
    58     try:
    59         batch_id, ac_id = access_code.rsplit('-', 1)
    60     except:
    61         return None
    62     if batch_id not in site['accesscodes'].keys():
    63         return None
    64     batch = site['accesscodes'][batch_id]
    65     return batch.getAccessCode(access_code)
Note: See TracChangeset for help on using the changeset viewer.