6.5.1 New

New method is used to create an empty landmark or landmark category item. You can use the new item as a template. It is available only in synchronous mode.

The following is an example for using New:

new_output = landmark_handle.call('New', {'Type': u'Landmark'})

The following table summarizes the specification of New:

Interface IDataSource
Operation Creates an empty landmark or category item.
Response Model Synchronous
Pre-condition IDataSource interface is loaded.
Post-condition Nil

Input Parameters

Input parameter specifies the content type to create.

Table 6.86: Input parameters for New
Name Type Range Description
Type unicode string Landmark
Category
Specifies the content type to create.


Output Parameters

Output parameters contain ErrorCode, and ErrorMessage if the operation fails.

Table 6.87: Output parameters for New
Name Type Range (Type: string) Description
ErrorCode int NA Service specific error code on failure of the operation.
ErrorMessage string NA Error description in Engineering English.
ReturnValue map
Landmark or category, as discussed in the Key Values 6.5.8 section.
NA For content template description, see Landmark and Category in the Key Values 6.5.8 section.


Errors

The following table lists the error codes and their values:

Table 6.88: Error codes
Error code value Description
1007 No memory


Error Messages

The following table lists the error messages and their description:


Table 6.89: Error messages
Error messages Description
Landmarks:New:Type is missing Indicates Type is missing or data type of Type is mismatched.
Landmarks:New:Type is invalid Indicates that Type is not a value in the given range.


Example

The following sample code illustrates how to create an empty landmark/category item:

import scriptext

landmark_handle = scriptext.load('Service.Landmarks', 'IDataSource')
try:
    new_output = landmark_handle.call('New', {'Type': u'Landmark'})
    error = new_output['ErrorCode']
    if error != 0:
        print "Error in creating the landmark item"
    else:
        print "The Landmark item is created"

except scriptext.ScriptextError, err:
    print "Error performing the operation : ", err

See About this document... for information on suggesting changes.