How to use the pyral.entity.Persistable function in pyral

To help you get started, we’ve selected a few pyral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
self.__dict__[item] = value
        if item == 'MatchingText':
            # scrub out the alm specific html tags 
            scrubbed = re.sub(self.tagged_field_name_pattern, so_element_text, value)
            scrubbed = re.sub(self.bolding_pattern, so_bolded_text, scrubbed)
            self.__dict__[item] = scrubbed
        return self.__dict__[item]

#################################################################################################

# ultimately, the classFor dict is what is intended to be exposed as a means to limit
# instantiation to concrete classes, although because of dyna-types that is no longer
# very strictly enforced
# 

classFor = { 'Persistable'             : Persistable,
             'DomainObject'            : DomainObject,
             'WorkspaceDomainObject'   : WorkspaceDomainObject,
             'Subscription'            : Subscription,
             'User'                    : User,
             'UserProfile'             : UserProfile,
             'UserPermission'          : UserPermission,
             'Workspace'               : Workspace,
             'WorkspaceConfiguration'  : WorkspaceConfiguration,
             'WorkspacePermission'     : WorkspacePermission,
             'Type'                    : Type,
             'TypeDefinition'          : TypeDefinition,
             'AttributeDefinition'     : AttributeDefinition,
             'Program'                 : Program,
             'Project'                 : Project,
             'ProjectPermission'       : ProjectPermission,
             'Artifact'                : Artifact,
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
# chase the revs_ref set the RevisionHistory.Revisions attribute with that Revisions collection
        revisions = getCollection(self._context, revs_ref, _disableAugments=False)
        rev_hist.Revisions = [revision for revision in revisions]
        # mark the RevisionHistory instance as being fully hydrated
        rev_hist._hydrated = True
        return rev_hist

##################################################################################################
#
# subclasses (both abstract and concrete) that descend from Persistable
#

class Subscription(Persistable):  pass

class AllowedAttributeValue(Persistable):  pass  # only used in an AttributeDefinition
class AllowedQueryOperator (Persistable):  pass  # only used in an AttributeDefinition 
                                                 #  (for AllowedQueryOperators)

class DomainObject(Persistable):
    """ This is an Abstract Base class """
    pass

class User (DomainObject): 
    USER_ATTRIBUTES = ['oid', 'ref', 'ObjectID', 'ObjectUUID', '_ref', 
                       '_CreatedAt', '_hydrated', 
                       'UserName', 'DisplayName', 'EmailAddress', 
                       'FirstName', 'MiddleName', 'LastName', 
                       'ShortDisplayName', 
                       'SubscriptionAdmin',
                       'Role',
                       'UserPermissions',
                       #'TeamMemberships',
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
for attribute_name in sorted(other_attributes):
            #value = getattr(self, attribute_name)
            #
            # bypass any attributes that the item might have but doesn't have 
            # as a query fetch clause may have been False or didn't include the attribute
            try: 
                value = getattr(self, attribute_name)
            except AttributeError: 
##
##                print("  unable to getattr for |%s|" % attribute_name)
##
                continue
            attr_name = attribute_name
            if attribute_name.startswith('c_'):
                attr_name = attribute_name[2:]
            if not isinstance(value, Persistable):
                anv = "    %-24s  : %s" % (attr_name, value)
            else:
                mo = re.search(r' \'pyral.entity.(\w+)\'>', str(type(value)))
                if not mo:
                    anv = "    %-24s : %s" % (attr_name, value)
                    continue

                cln = mo.group(1)
                anv = "    %-24s  : %-27.27s" % (attr_name, cln + '.ref')
                if   isinstance(value, Artifact):
                    # also want the OID, FormattedID
                    anv = "%s (OID  %s  FomattedID  %s)" % (anv, value.oid, value.FormattedID)
                elif isinstance(value, User):
                    # also want the className, OID, UserName, DisplayName
                    anv = "    %-24s  : %s.ref  (OID  %s  UserName %s  DisplayName %s)" % \
                          (attr_name, cln, value.oid, value.UserName, value.DisplayName)
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
rev_hist = RevisionHistory(rev_hist_oid, 'RevisonHistory', collection_ref, self._context)
        # chase the revs_ref set the RevisionHistory.Revisions attribute with that Revisions collection
        revisions = getCollection(self._context, revs_ref, _disableAugments=False)
        rev_hist.Revisions = [revision for revision in revisions]
        # mark the RevisionHistory instance as being fully hydrated
        rev_hist._hydrated = True
        return rev_hist

##################################################################################################
#
# subclasses (both abstract and concrete) that descend from Persistable
#

class Subscription(Persistable):  pass

class AllowedAttributeValue(Persistable):  pass  # only used in an AttributeDefinition
class AllowedQueryOperator (Persistable):  pass  # only used in an AttributeDefinition 
                                                 #  (for AllowedQueryOperators)

class DomainObject(Persistable):
    """ This is an Abstract Base class """
    pass

class User (DomainObject): 
    USER_ATTRIBUTES = ['oid', 'ref', 'ObjectID', 'ObjectUUID', '_ref', 
                       '_CreatedAt', '_hydrated', 
                       'UserName', 'DisplayName', 'EmailAddress', 
                       'FirstName', 'MiddleName', 'LastName', 
                       'ShortDisplayName', 
                       'SubscriptionAdmin',
                       'Role',
                       'UserPermissions',
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
revs_ref     = rev_hist_raw['Revisions']['_ref']  # this is the "true" Revisions collection ref
        # create a RevisionHistory instance with oid, Name and _ref field information
        rev_hist = RevisionHistory(rev_hist_oid, 'RevisonHistory', collection_ref, self._context)
        # chase the revs_ref set the RevisionHistory.Revisions attribute with that Revisions collection
        revisions = getCollection(self._context, revs_ref, _disableAugments=False)
        rev_hist.Revisions = [revision for revision in revisions]
        # mark the RevisionHistory instance as being fully hydrated
        rev_hist._hydrated = True
        return rev_hist

##################################################################################################
#
# subclasses (both abstract and concrete) that descend from Persistable
#

class Subscription(Persistable):  pass

class AllowedAttributeValue(Persistable):  pass  # only used in an AttributeDefinition
class AllowedQueryOperator (Persistable):  pass  # only used in an AttributeDefinition 
                                                 #  (for AllowedQueryOperators)

class DomainObject(Persistable):
    """ This is an Abstract Base class """
    pass

class User (DomainObject): 
    USER_ATTRIBUTES = ['oid', 'ref', 'ObjectID', 'ObjectUUID', '_ref', 
                       '_CreatedAt', '_hydrated', 
                       'UserName', 'DisplayName', 'EmailAddress', 
                       'FirstName', 'MiddleName', 'LastName', 
                       'ShortDisplayName', 
                       'SubscriptionAdmin',
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
# mark the RevisionHistory instance as being fully hydrated
        rev_hist._hydrated = True
        return rev_hist

##################################################################################################
#
# subclasses (both abstract and concrete) that descend from Persistable
#

class Subscription(Persistable):  pass

class AllowedAttributeValue(Persistable):  pass  # only used in an AttributeDefinition
class AllowedQueryOperator (Persistable):  pass  # only used in an AttributeDefinition 
                                                 #  (for AllowedQueryOperators)

class DomainObject(Persistable):
    """ This is an Abstract Base class """
    pass

class User (DomainObject): 
    USER_ATTRIBUTES = ['oid', 'ref', 'ObjectID', 'ObjectUUID', '_ref', 
                       '_CreatedAt', '_hydrated', 
                       'UserName', 'DisplayName', 'EmailAddress', 
                       'FirstName', 'MiddleName', 'LastName', 
                       'ShortDisplayName', 
                       'SubscriptionAdmin',
                       'Role',
                       'UserPermissions',
                       #'TeamMemberships',
                       #'UserProfile'
                      ]
    def details(self):