> So - show me what it would look like. Show me how I, as a third party,
> would use your proposed syntax to define output that would match
> Django's existing serialization scheme. Yes, this serialization format
> will exist as a built in default; but I should be able to reproduce
> that format in my own code if I want.

# Fair enough.

if code > literacy: # here
    so_be_it()


class DefaultSerializedField(object):
    belongs_to = "field"
    as_tag = true

class DefaultSerializedSpecialField(DefaultSerializedField):
    " For pk and modelname "
    belongs_to = None
    as_tag = false

class DefaultSerializedModel(object):
    exclude = []
    fields = None
    def __init__(self,embed_level):
        self.embed_level = embed_level


#Somewhere in the dark forest of BaseSerializer implemented

if not config_is_passed_as_an_arg:
    config = DefaultSerializedModel(embed_level=0)

for item in queryset:
    pk_config = getattr(config, 'pk', DefaultSerializedSpecialField())
    self.process_pk(pk_config)

    mn_config = getattr(config, 'modelname',
DefaultSerializedSpecialField())
    self.process_model_name(mn_config)

    fields = getattr(config, 'fields',())
    for name, field_config in fields.:
            if not name_of(field) in item.exclude:
                self.process_field(name, field_config)
    if not fields:
        default_config = DefaultSerializedField()
        for field in regular_field_of(item):
            if not name_of(field) in item.exclude:
                self.process_field(name_of(field), default_config)

The idea is not to abandon all current assumption about how
serialization proceeds, but to do so only to a degree such that we get
the flexibility needed.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to