#1335 Make attachment subclasses be polymorphic_on - NEEDS SCRIPT

v1.0.0
closed
sf-8 (45)
General
nobody
2015-08-20
2011-01-14
No

Work on [#1280] showed that there is no good way to enumerate attachments within app/project, because we have wild varying object structure in the same collection, without type info on Ming level. Besides maintenance tasks like that ticket, it may be useful to provide admin tasks in the web app, like "list/moderate all attachments within project/tool".

Let's consider tracker app example. For it, attachments can be of types TicketAttachment (direct attachment to ticket) and DiscussionAttachment (attachment to ticket comment).

TicketAttachment has:

artifact_id=FieldProperty(S.ObjectId)

While DiscussionAttachment:

artifact_id=FieldProperty(str)

When doing M.TicketAttachment.query.find(), you'll get validation exception on first hit of DiscussionAttachment in the underlying collection, and vice-versa. So, you have to figure out additional duck-type style discriminators to add to find(), essentilly doing adhoc manual polymorphic_on. Rather, Ming should do that underneath.

Related

Tickets: #1280

Discussion

  • Rick Copeland - 2011-02-01
    • size: --> 4
     
  • Rick Copeland - 2011-02-01
    • status: open --> in-progress
    • assigned_to: Rick Copéland

    description has changed

     
  • Rick Copeland - 2011-02-02
    • summary: Make attachment subclasses be polymorphic_on --> Make attachment subclasses be polymorphic_on - NEEDS SCRIPT
    • status: in-progress --> closed
     
  • Rick Copeland - 2011-02-02

    The script:

    allurapaste script /var/local/config/production.ini ../scripts/make-attachments-polymorphic.py
    
     

Log in to post a comment.