Previous topic

5.14. plmapp_tags — Template tags and filters used by openPLM

Next topic

5.16. thumbnailers — Utilities to generate a thumbnail from a file

This Page


Previous versions


5.15. references — module to generate a new reference

plmapp.references.rx_bad_ref = <_sre.SRE_Pattern object at 0xc306d30>

Regular expression to test if a reference is invalid (forbidden characters)

plmapp.references.REFERENCE_PATTERNS = {'shared': False, 'part': (u'PART_{number:05d}', '^PART_(\\d+)$'), 'doc': (u'DOC_{number:05d}', '^DOC_(\\d+)$')}

default reference patterns, generates references like PART_00001 and DOC_00001


Raises a ValueError if reference is not valid.


Raises a ValueError if revision is not valid.

plmapp.references.get_new_reference(user, cls, start=0, inbulk_cache=None)[source]

Returns a new reference for creating a PLMObject of type cls.

user is the user who will create the object.

By default, the formatting is PART_000XX if cls is a subclass of Part and DOC_000XX otherwise.

The number is the count of Parts or Documents plus start plus 1. It is incremented while an object with the same reference already exists. start can be used to create several creation forms at once.

Parts and documents have an independent reference number. For example, the first suggested part reference is PART_00001 and the first suggested document is DOC_00001 even if parts have been created.


The returned referenced may not be valid if a new object has been created after the call to this function.

plmapp.references.parse_reference_number(reference, class_)[source]

Parses reference and returns the reference number. The reference number is the text that increases after each creation of a new document or part.

  • reference – reference of the created object
  • class – class of the created object

the reference number, 0 if there is no reference

Return type: