mediagoblin-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GMG-Devel] writting media views mentoring, please!


From: Christopher Allan Webber
Subject: Re: [GMG-Devel] writting media views mentoring, please!
Date: Sun, 24 Jun 2012 22:32:29 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Joar Wandborg <address@hidden> writes:

> Only __init__.py, models.py and migrations.py need to be there.
>
> The __init__.py MEDIA_MANAGER object should be filled in, we only _need_ the
> fields sniff_handler, processor, display_template, accepted_extensions for
> the application not to crash.
>
> In __init__.py, the sniffing handler and the processing function should be
> imported, so that you can put the references to those in the MEDIA_MANAGER.
>
> For examples on the sniffing handler and the processing functions look in
> mediagoblin/media_types/image/processing.py.
>
> I think Chris Webber or Elvenlord Elrond can fill you in on models.py and
> migrations.py, as I don't grok that part of the infrastructure as good as
> they might.

models.py can contain more than one model, but probably it contains just
the media-specific information.  This is basically what
MediaEntry.media_data() returns.

So, basically, with every media entry, it has both information general
to *any* type of media (which goes in the MediaEntry class/table), then
there's a separate row in a separate table that is information specific
to this media type.

You can look at mediagoblin/media_types/ascii/models.py as the most
"minimal" version of what's needed and largely mime this.  Basically,
you need a table definition, you need to list that table as DATA_MODEL,
and you need to list it in MODELS.  DATA_MODEL is what's expected to be
the MediaEntry.media_data() for this table, and MODELS is a list of
*all* tables that might be used by this media type (but for now, you can
assume you can just edit models.py).

For a complex version of models, look at
mediagoblin/media_types/image/models.py which contains a lot of "extra
data".  I'd say if you think you need extra data for your model, let's
discuss it as we go.

As for migrations.py, you don't need to touch that until later if you
are making a new media type.  Basically, if the structure of your media
data tables or related change, you can describe migrations that can be
run from here.

Hope that helps!
 - Chris


reply via email to

[Prev in Thread] Current Thread [Next in Thread]