1 """
2 Resources that are not services.
3 """
4
5
6
7
8
9
10
11 from gavo import base
12 from gavo import rscdef
13 from gavo import svcs
14 from gavo import utils
15 from gavo.registry import common
16
17
18 -class NonServiceResource(
19 base.Structure,
20 base.StandardMacroMixin,
21 base.ComputedMetaMixin):
22 """A base class for resources that are not services.
23 """
31
32
33 -class ResRec(rscdef.IVOMetaMixin, NonServiceResource):
34 """A resource for pure registration purposes.
35
36 A Resource without DaCHS defined behaviour. This can be
37 Organizations or Instruments, but possibly also external services
38
39 All resources must either have an id (which is used in the construction of
40 their IVOID), or you must give an identifier meta item.
41
42 You must further set the following meta items:
43
44 - resType specifying the kind of resource record. You should not
45 use this element to build resource records for services or tables
46 (use the normal elements, even if the actual resrouces are external
47 to DaCHS). resType can be registry, organization, authority,
48 deleted, or anything else for which registry.builders has a
49 handling class.
50 - title
51 - subject(s)
52 - description
53 - referenceURL
54 - creationDate
55
56 Additional meta keys (e.g., accessURL for a registry) may be required
57 depending on resType. See the registry section in the operator's guide.
58
59 ResRecs can also have publication children. These will be turned into
60 the appropriate capabilities depending on the value of the render
61 attribute.
62 """
63 name_ = "resRec"
64 _rd = rscdef.RDAttribute()
65
66 _publications = base.StructListAttribute("publications",
67 childFactory=svcs.Publication,
68 description="Capabilities the record should have (this is empty"
69 " for standards, organisations, instruments, etc.)")
70
72 """returns publications for set names in names.
73
74 names must be a python set.
75 """
76 for pub in self.publications:
77 if pub.sets&names:
78 yield pub
79
80
84
85
87 """a remainder of a deleted resource. These are always built from information
88 in the database, since that is the only place they are remembered.
89 """
90 resType = "deleted"
91
92 _resTuple = base.RawAttribute("resTuple")
93
96
99
102
104 self._completeElementNext(DeletedResource, ctx)
105 self.rd = _FakeRD(self.resTuple["sourceRD"])
106 self.id = self.resTuple["resId"]
107 self.dateUpdated = self.resTuple["recTimestamp"]
108