garfield.lockers Package

This package contains all modules and sub-packages necessary for the locker management system.

garfield.lockers.db Module

This module contains the OR-Mappings between the locker SQL tables and functions and the Python objects. It also provides back-end helper functions that do not belong into the GUI.

class garfield.lockers.db.CBFLocker

Bases: object

apply(query)
description = u'Schlie\xdff\xe4cher: Ein-/Auszahlungen'
prio = 60
class garfield.lockers.db.CoinSlotType

Bases: object

@DynamicAttrs

class garfield.lockers.db.CoinValue

Bases: object

@DynamicAttrs

class garfield.lockers.db.ContractNumberRange

Bases: object

@DynamicAttrs

class garfield.lockers.db.Cost

Bases: object

@DynamicAttrs

class garfield.lockers.db.Duration

Bases: object

@DynamicAttrs

description
max_lease_duration
class garfield.lockers.db.EmailDomain

Bases: object

@DynamicAttrs

static is_valid_email(sess, email)
is_valid_local_part(local_part)
class garfield.lockers.db.FreeLockerAndLeaseContractEnd

Bases: object

@DynamicAttrs

class garfield.lockers.db.Key

Bases: object

@DynamicAttrs

static create(sess, lock, description, key_location)
hand_out(lease_contract)
lose()
move(new_key_location)
take_back(key_location)
update(description)
class garfield.lockers.db.KeyLocation

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseContract

Bases: object

@DynamicAttrs

allows_giving_out_keys
balance
cash_payment(amount, description, cash_box)

Returns the log entry logging the cash payment.

cash_return(amount, description, cash_box)

Returns the log entry logging the cash return.

check_locker(coin_value, empty=True, comment=None)
close(closing_date)
close_recently(closing_date)
closed
static create(sess, person, locker, start_date, end_date)

Creates a new contract and returns the new contract object.

delete()

Marks the contract as deleted.

num_keys_in_use
owns_keys
remove_from_storage(comment)
sign()

Logs that the contract has been signed by both parties.

to_pdf(environment_sess)
uncheck_locker()
update(start_date, end_date)

Updates the contract’s attributes. Can only by done for unsigned contracts.

class garfield.lockers.db.LeaseContractEnd

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseLog

Bases: object

@DynamicAttrs

cancel_lost_key_to_revenue(comment)
description
lost_key_to_revenue(gross_value, service_date, tax_group, description)
class garfield.lockers.db.LeaseLogBankAccount

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseLogCashBox

Bases: object

@DynamicAttrs

cancel_payment(comment)
cancel_return(comment)
class garfield.lockers.db.LeaseLogExtraDeposit

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseLogKey

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseLogLock

Bases: object

@DynamicAttrs

static find_newest(sess, lease_contract, lock)

Returns the newest log entry of lease_contract concerning lock.

class garfield.lockers.db.LeaseLogMoneyChange

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseLogRevenue

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseLogTermination

Bases: object

@DynamicAttrs

class garfield.lockers.db.LeaseLogType

Bases: garfield.database.TypeDescriptionMixin

@DynamicAttrs

description

Returns the description for the current instance of the base class.

The primary key of the object is used as the key to the descriptions dictionary _DESCRIPTIONS.

class garfield.lockers.db.LeaseRevenueSplit

Bases: object

@DynamicAttrs

static add_subtotal(sess, subtotal)
net_value
tax_value
class garfield.lockers.db.LeaseRevenueType

Bases: garfield.database.TypeDescriptionMixin

@DynamicAttrs

description

Returns the description for the current instance of the base class.

The primary key of the object is used as the key to the descriptions dictionary _DESCRIPTIONS.

class garfield.lockers.db.LeaseTerminationReason

Bases: object

@DynamicAttrs

class garfield.lockers.db.Lock

Bases: object

@DynamicAttrs

static create(sess, cylinder_nr, locker_location, lock_cost)
has_access_from_other_contracts(contract)
set_locker(old_locker, new_locker)
update(cylinder_nr, locker_location, lock_cost)
class garfield.lockers.db.LockCost

Bases: object

@DynamicAttrs

class garfield.lockers.db.LockLog

Bases: object

@DynamicAttrs

description
class garfield.lockers.db.LockLogKeyChange

Bases: object

@DynamicAttrs

class garfield.lockers.db.LockLogLockerChange

Bases: object

@DynamicAttrs

class garfield.lockers.db.LockLogType

Bases: garfield.database.TypeDescriptionMixin

@DynamicAttrs

description

Returns the description for the current instance of the base class.

The primary key of the object is used as the key to the descriptions dictionary _DESCRIPTIONS.

class garfield.lockers.db.Locker

Bases: object

@DynamicAttrs

static create(sess, official_number, locker_location, duration, size, cost, lock=None)
set_lock(lock=None)
update(official_number, locker_location, duration, size, cost, lock=None)
update_state(new_state, comment=None)
class garfield.lockers.db.LockerLocation

Bases: object

@DynamicAttrs

class garfield.lockers.db.LockerLog

Bases: object

@DynamicAttrs

description
class garfield.lockers.db.LockerLogCoinValueChange

Bases: object

@DynamicAttrs

static add_subtotal(sess, subtotal)
class garfield.lockers.db.LockerLogStateChange

Bases: object

@DynamicAttrs

class garfield.lockers.db.LockerLogType

Bases: garfield.database.TypeDescriptionMixin

@DynamicAttrs

description

Returns the description for the current instance of the base class.

The primary key of the object is used as the key to the descriptions dictionary _DESCRIPTIONS.

class garfield.lockers.db.LockerState

Bases: garfield.database.TypeDescriptionMixin

@DynamicAttrs

description

Returns the description for the current instance of the base class.

The primary key of the object is used as the key to the descriptions dictionary _DESCRIPTIONS.

class garfield.lockers.db.Person

Bases: object

@DynamicAttrs

authenticate(authentication_key)
static clean_authentication_key(key)
static create(sess, email)
static generate_authentication_key(environment_sess)
is_valid_authentication_key(authentication_key)
manually_authenticated(full_name)

Acknowledge, that the connection between the person with name full_name and the email-adress has been verified manually, without querying for the authentication key.

send_authentication_key(environment_sess, authentication_key)
set_authentication_key(authentication_key)
set_full_name(full_name)
class garfield.lockers.db.PersonDetail

Bases: object

@DynamicAttrs

static create(sess, person, address, postalcode, city, country, phone_number)
delete()
update(address, postalcode, city, country, phone_number)
class garfield.lockers.db.PersonLog

Bases: object

@DynamicAttrs

class garfield.lockers.db.PersonLogType

Bases: garfield.database.TypeDescriptionMixin

@DynamicAttrs

description

Returns the description for the current instance of the base class.

The primary key of the object is used as the key to the descriptions dictionary _DESCRIPTIONS.

class garfield.lockers.db.Request

Bases: object

@DynamicAttrs

close(reason)
static create(sess, person, start_date, duration, comment, min_offset, max_offset, locker_location)
requested_duration
requested_duration_description
reserve_locker(locker=None)
update(start_date, duration, comment, min_offset, max_offset, locker_location)
class garfield.lockers.db.RequestClosingReason

Bases: garfield.database.TypeDescriptionMixin

@DynamicAttrs

description

Returns the description for the current instance of the base class.

The primary key of the object is used as the key to the descriptions dictionary _DESCRIPTIONS.

class garfield.lockers.db.Size

Bases: object

@DynamicAttrs

description
garfield.lockers.db.add_lockers_cash_box_filters(cb_filters, **_)
garfield.lockers.db.calculate_end_date(start_date, duration)

Returns the end date of a lease contract, based on the start_date and the contract’s duration. The end date is the last date on which the contract is valid.

>>> import datetime
>>> calculate_end_date(datetime.date(2011, 01, 15), relativedelta(months=1))
datetime.date(2011, 2, 14)
>>> calculate_end_date(datetime.date(2011, 01, 31), relativedelta(months=1))
datetime.date(2011, 2, 28)
garfield.lockers.db.duration_as_str(duration)
garfield.lockers.db.send_locker_mail(environment_sess, msg)
garfield.lockers.db.setup_lockers_environment(config, garfield_sess, garfield_meta, environment_sess)
garfield.lockers.db.setup_tables(sess, meta)