collective / rapido.core

2 stars 2 forks source link

get_record should take a default like get #8

Open djay opened 8 years ago

djay commented 8 years ago

Would make some code easier. For example

    record = context.app.get_record(path)
    if record is None:
        total = 0
    else:
        total = record.get('total', 0)
    return "votes is %s" % str(total)

becomes

   return "votes is %s" % str( context.app.get_record(path, {}).get('total', 0))