Module: content.py

Author:

Stefan Eletzhofer

Date:

2012-05-17

Abstract

This module offers functions to manipulate content items.

Module Documentation

nexiles.tools.api.content.create_content_info(role, file_path, mimetype) mapping

Create a content info dict used by the back end to add content to a business object.

Parameters:
  • role – The role of the new content item.

  • file_path – The path of the file to be uploaded.

  • mimetype – (optional) a mime type

Returns:

new business object iteration

nexiles.tools.api.content.delete_content(resource, oid, role, filename) new_doc

Delete named content item.

Note

This will cause a new iteration of the business object.

The role is one of the roles Windchill content items may have, like:

  • PRIMARY

  • SECONDARY

  • etc

If iterate is set to False, then no new iteration is made automatically. The document is assumed to be checked out already. The caller is resposnible to check in the document afterwards.

If iterate is set to Ture (the default), then the message supplied in message is used for the check out and check in.

Parameters:
  • resource – The resource – see nexiles.tools.api.get_resource()

  • oid – The OID of the business object

  • role – The role of the content item.

  • filename – The name of the content item to delete.

  • iterate – whether or not to create a new iteration

  • message – the checkin/checkout message to use

Returns:

new business object iteration

nexiles.tools.api.content.list_content(resource, oid, role) sequence

List the content items of the given business object.

If role is given, filter by that role.

The role is one of the roles Windchill content items may have, like:

  • PRIMARY

  • SECONDARY

  • etc

Parameters:
Returns:

sequence of content item infos

nexiles.tools.api.content.upload_content(resource, oid, role, file_path) new business object iteration

Upload content to a business object of given resource type.

Note

This will cause a new iteration of the business object.

The role is one of the roles Windchill content items may have, like:

  • PRIMARY

  • SECONDARY

  • etc

If no mime type is specified, the server will guess one based on the supplied file name.

Parameters:
  • resource – The resource – see nexiles.tools.api.get_resource()

  • oid – The OID of the business object

  • role – The role of the new content item.

  • file_path – The path of the file to be uploaded.

  • mimetype – (optional) a mime type

  • iterate – whether or not to create a new iteration

  • message – the checkin/checkout message to use

Returns:

new business object iteration