Package perforce :: Module api :: Class SpecElem
[frames] | no frames]

Class SpecElem



object --+
         |
        SpecElem

A Perforce form specification element.

Describes the attributes of a single field in a Perforce form.

There are several field types, each of which is queryable through the is*() methods.

Instance Methods
 
isDate()
Query if this field is a 'date' field
 
isList()
Query if this field is a multi-line list field.
 
isReadOnly()
Returns: boolean
 
isRequired()
Returns: boolean
 
isSelect()
Query if this field is a 'select' field.
 
isSingle()
Returns: boolean
 
isText()
Query if this field is a muti-line block text field.
 
isWords()
Query if this field is a word-based field.

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties
int code
The field's unique integer code.
int maxLength
The recommended maximum length of the field in characters.
int numWords
The number of words on each line for word-based fields.
str or unicode or None preset
The default value for read-only fields.
int sequence
An integer value that provides a hint for the field's order in the form.
str or unicode tag
The field's name.
tuple of str or unicode, list of tuple of str unicode or None values
A tuple of the allowed values of a 'select' field.

Inherited from object: __class__

Method Details

isDate()

 
Query if this field is a 'date' field
Returns:
boolean

isList()

 

Query if this field is a multi-line list field.

List fields store their value as a list of values, one for each line.
Returns:
boolean

isReadOnly()

 
Returns:
boolean

isRequired()

 
Returns:
boolean

isSelect()

 

Query if this field is a 'select' field.

Select fields hold a single word chosen from a list of possible values.
Returns:
boolean

See Also: self.values for a tuple of the actual allowed values.

isSingle()

 
Returns:
boolean

isText()

 

Query if this field is a muti-line block text field.

Text fields store their value as a single multi-line string.
Returns:
boolean

isWords()

 

Query if this field is a word-based field.

Single-word fields store each line as a single string. Multi-word fields store each line as a tuple of strings.
Returns:
boolean


Property Details

maxLength

The recommended maximum length of the field in characters.

If the value is zero then there is no recommended maximum length.
Type:
int

values

A tuple of the allowed values of a 'select' field. Or a list of tuples of the allowed values for each of the words in a multi-word field.

None if no predefined values for this field.
Type:
tuple of str or unicode, list of tuple of str unicode or None