Harshit Bansal writes: > How can this composability be achieved in a model? I mean that the > size of a table is fixed in a model and if a style describes just a > partial set of attributes then what would be stored in other > attributes?
(1) In a NoSQL database (MongoDB, for example), you can store a partial record with no preparation. This is a good thing and a bad thing, depending on how the now-you-see-them-now-you-don't fields are used. (2) SQLAlchemy (and the underlying RDBMSes) allow you to have optional fields. This is implemented by storing NULL in the missing field. > Also how would this partial style be applied to a mailing list? A style would be a list of stylets (NOTE! none of the identifiers below are real! All names have been changed to protect my ignorance!): s1 = { notmetoo_default: True, nomail_default: False } s2 = { notmetoo_default: False, ack_default: True } newstyle = [s1, s2] def apply_style(style, mlist): try: mlist.start_transaction() for s in style: # common attributes will overwrite earlier values mlist.apply_stylet(s) # make sure all attributes are set to sane values mlist.validate_style() mlist.commit_transaction() except Exception: mlist.rollback_transaction() > 2: Current 'IStyle' interface allows us to define either a partial > style(stylet, describing just a partial set of attributes) or a > complete style. But is that possible with a model? There should be either an SQLAlchemy option for each attribute to be optional, or maybe the inverse attribute of required. Use that option on the model attributes. > 3: If I go for style composabiltiy as described by you then how would > I represent that idea in REST and Postorius? Basically the same way. _______________________________________________ Mailman-Developers mailing list Mailman-Developers@python.org https://mail.python.org/mailman/listinfo/mailman-developers Mailman FAQ: http://wiki.list.org/x/AgA3 Searchable Archives: http://www.mail-archive.com/mailman-developers%40python.org/ Unsubscribe: https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org Security Policy: http://wiki.list.org/x/QIA9