def resolve_document_version(document, resource, method, latest_doc=None):
 resource_def = app.config['DOMAIN'][resource]
 version = app.config['VERSION']
 latest_version = app.config['LATEST_VERSION']
 if (resource_def['versioning'] is True):
  if ((method == 'GET') and (latest_doc is None)):
   if (version not in document):
    document[version] = 1
   document[latest_version] = document[version]
  if ((method == 'GET') and (latest_doc is not None)):
   if (version not in latest_doc):
    document[version] = 1
    document[latest_version] = document[version]
   else:
    document[latest_version] = latest_doc[version]
    if (version not in document):
     document[version] = 1
  if (method == 'POST'):
   document[version] = 1
  if ((method == 'PUT') or (method == 'PATCH') or ((method == 'DELETE') and (resource_def['soft_delete'] is True))):
   if (not latest_doc):
    abort(500, description=debug_error_message('I need the latest document here!'))
   if (version in latest_doc):
    document[version] = (latest_doc[version] + 1)
   else:
    document[version] = 1

def resolve_document_version ( document , resource , method , latest_doc = None ) : resource_def = app . config [ 'DOMAIN' ] [ resource ] version = app . config [ 'VERSION' ] latest_version = app . config [ 'LATEST_VERSION' ] if ( resource_def [ 'versioning' ] is True ) : if ( ( method == 'GET' ) and ( latest_doc is None ) ) : if ( version not in document ) : document [ version ] = 1 document [ latest_version ] = document [ version ] if ( ( method == 'GET' ) and ( latest_doc is not None ) ) : if ( version not in latest_doc ) : document [ version ] = 1 document [ latest_version ] = document [ version ] else : document [ latest_version ] = latest_doc [ version ] if ( version not in document ) : document [ version ] = 1 if ( method == 'POST' ) : document [ version ] = 1 if ( ( method == 'PUT' ) or ( method == 'PATCH' ) or ( ( method == 'DELETE' ) and ( resource_def [ 'soft_delete' ] is True ) ) ) : if ( not latest_doc ) : abort ( 500 , description = debug_error_message ( 'I need the latest document here!' ) ) if ( version in latest_doc ) : document [ version ] = ( latest_doc [ version ] + 1 ) else : document [ version ] = 1
version number logic for all methods .