Support syntax for load: self.trial_attachments(doc)[name] # -- does this work syntactically? # (In any event a 2-stage store will work) Support syntax for store: self.trial_attachments(doc)[name] = value
(self, trial)
| 308 | return "ATTACH::{}::{}".format(trial["tid"], name) |
| 309 | |
| 310 | def trial_attachments(self, trial): |
| 311 | """ |
| 312 | Support syntax for load: self.trial_attachments(doc)[name] |
| 313 | # -- does this work syntactically? |
| 314 | # (In any event a 2-stage store will work) |
| 315 | Support syntax for store: self.trial_attachments(doc)[name] = value |
| 316 | """ |
| 317 | |
| 318 | # don't offer more here than in MongoCtrl |
| 319 | class Attachments: |
| 320 | def __contains__(_self, name): |
| 321 | return self.aname(trial, name) in self.attachments |
| 322 | |
| 323 | def __getitem__(_self, name): |
| 324 | return self.attachments[self.aname(trial, name)] |
| 325 | |
| 326 | def __setitem__(_self, name, value): |
| 327 | self.attachments[self.aname(trial, name)] = value |
| 328 | |
| 329 | def __delitem__(_self, name): |
| 330 | del self.attachments[self.aname(trial, name)] |
| 331 | |
| 332 | return Attachments() |
| 333 | |
| 334 | def __iter__(self): |
| 335 | try: |
no test coverage detected