Exemplo n.º 1
0
def AllLocationTemplates(dummy_context):
    """Which MobilePhone templates exists
    """
    terms = []
    uidutil = getUtility(IIntIds)
    for (oid, oobj) in uidutil.items():
        if ILocation.providedBy(oobj.object) and \
        oobj.object.isTemplate:
            myString = u"%s [T]" % (oobj.object.getDcTitle())
            terms.append(SimpleTerm(oobj.object,
                                    token=oid,
                                    title=myString))
    return SimpleVocabulary(terms)
Exemplo n.º 2
0
def AllLocations(dummy_context):
    """In which production state a host may be
    """
    terms = []
    uidutil = getUtility(IIntIds)
    for (oid, oobj) in uidutil.items():
        if ILocation.providedBy(oobj.object):
            myString = u"%s" % (oobj.object.getDcTitle())
            terms.append(\
                SimpleTerm(oobj.object,
                           token=oid,
                           title=myString))
    return SimpleVocabulary(terms)
Exemplo n.º 3
0
def AllBuildingsVocab(dummy_context):
    """Which locations are there
    """
    terms = []
    uidutil = getUtility(IIntIds)
    for (oid, oobj) in uidutil.items():
        if IBuilding.providedBy(oobj.object):
            locationObj = oobj.object.__parent__
            if ILocation.providedBy(locationObj):
                myString = u"%s / %s" % (locationObj.getDcTitle(),
                                         oobj.object.getDcTitle())
                terms.append(\
                    SimpleTerm(oobj.object.objectID,
                               str(oobj.object.objectID),
                               myString))
    return SimpleVocabulary(terms)
Exemplo n.º 4
0
def AllRoomsVocab(dummy_context):
    """Which locations are there
    """
    terms = []
    try:
        uidutil = getUtility(IIntIds)
        for (oid, oobj) in uidutil.items():
            if IRoom.providedBy(oobj.object):
                buildingObj = oobj.object.__parent__
                if IBuilding.providedBy(buildingObj):
                    locationObj = buildingObj.__parent__
                    if ILocation.providedBy(locationObj):
                        myString = u"%s / %s / %s" % (locationObj.getDcTitle(),
                                                      buildingObj.getDcTitle(),
                                                      oobj.object.getDcTitle())
                        terms.append(\
                            SimpleTerm(oobj.object.objectID,
                                       str(oobj.object.objectID),
                                       myString))
        return SimpleVocabulary(terms)
    except ComponentLookupError:
        return SimpleVocabulary([])