Exemple #1
0
def not_expired(**view_args):
    """
    This action is only available against assets that have not expired.
    """

    asset_id = view_args.get('asset', request.args.get('asset'))

    if asset_id:

        asset = Asset.by_id(ObjectId(asset_id), projection={'expires': True})

        if asset:
            return not asset.expired

    return False
Exemple #2
0
 def get_asset(self, projection=None):
     """Get the asset the task will be run against"""
     return Asset.by_id(self.asset_id, projection=projection)