Admin Controllers

Dashboard

class mediadrop.controllers.admin.index.IndexController(*args, **kwargs)

Admin dashboard actions

allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130fb4dd90>
index(*args, **kwargs)

List recent and important items that deserve admin attention.

We do not use the mediadrop.lib.helpers.paginate() decorator because its somewhat incompatible with the way we handle ajax fetching with video_table(). This should be refactored and fixed at a later date.

Return type:Dict
Returns:
review_page
A webhelpers.paginate.Page instance containing unreviewed Media.
encode_page
A webhelpers.paginate.Page instance containing unencoded Media.
publish_page
A webhelpers.paginate.Page instance containing draft Media.
recent_media
A list of recently published Media.
comment_count
Total num comments
comment_count_published
Total approved comments
comment_count_unreviewed
Total unreviewed comments
comment_count_trash
Total deleted comments
media_table(*args, **kwargs)

Fetch XHTML to inject when the ‘showmore’ ajax action is clicked.

Parameters:
  • table (unicode) – awaiting_review, awaiting_encoding, or awaiting_publishing.
  • page (int) – Page number, defaults to 1.
Return type:

dict

Returns:

media

A list of Media instances.

Media

Media Admin Controller

class mediadrop.controllers.admin.media.MediaController(*args, **kwargs)
add_file(*args, **kwargs)

Save action for the AddFileForm.

Creates a new MediaFile from the uploaded file or the local or remote URL.

Parameters:
  • id (int or "new") – Media ID. If "new" a new Media stub is created.
  • file (cgi.FieldStorage or None) – The uploaded file
  • url (unicode or None) – A URL to a recognizable audio or video file
Return type:

JSON dict

Returns:

success

bool

message

Error message, if unsuccessful

media_id

The id which is important if new media has just been created.

file_id

The id for the newly created file.

edit_form

The rendered XHTML EditFileForm for this file.

status_form

The rendered XHTML UpdateStatusForm

allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130fb0ca50>
bulk(*args, **kwargs)

Perform bulk operations on media items

Parameters:
  • type – The type of bulk action to perform (delete)
  • ids – A list of IDs.
edit(*args, **kwargs)

Display the media forms for editing or adding.

This page serves as the error_handler for every kind of edit action, if anything goes wrong with them they’ll be redirected here.

Parameters:
  • id (int or "new") – Media ID
  • **kwargs – Extra args populate the form for "new" media
Returns:

media

Media instance

media_form

The MediaForm instance

media_action

str form submit url

media_values

dict form values

file_add_form

The AddFileForm instance

file_add_action

str form submit url

file_edit_form

The EditFileForm instance

file_edit_action

str form submit url

thumb_form

The ThumbForm instance

thumb_action

str form submit url

update_status_form

The UpdateStatusForm instance

update_status_action

str form submit url

edit_file(*args, **kwargs)

Save action for the EditFileForm.

Changes or deletes a MediaFile.

XXX: We do NOT use the @validate decorator due to complications with
partial validation. The JS sends only the value it wishes to change, so we only want to validate that one value. FancyValidator.if_missing seems to eat empty values and assign them None, but there’s an important difference to us between None (no value from the user) and an empty value (the user is clearing the value of a field).
Parameters:id (int) – Media ID
Return type:JSON dict
Returns:
success
bool
message
Error message, if unsuccessful
status_form
Rendered XHTML for the status form, updated to reflect the changes made.
index(*args, **kwargs)

List media with pagination and filtering.

Parameters:
  • page (int) – Page number, defaults to 1.
  • search (unicode or None) – Optional search term to filter by
  • podcast_filter (int or None) – Optional podcast to filter by
Return type:

dict

Returns:

media

The list of Media instances for this page.

search

The given search term, if any

search_form

The SearchForm instance

podcast

The podcast object for rendering if filtering by podcast.

json_error(*args, **kwargs)
merge_stubs(*args, **kwargs)

Merge in a newly created media item.

This is merges media that has just been created. It must have:
  1. a non-default thumbnail, or
  2. a file, or
  3. a title, description, etc
Parameters:
  • orig_id (int) – Media ID to copy data to
  • input_id (int) – Media ID to source files, thumbs, etc from
Returns:

JSON dict

save(*args, **kwargs)

Save changes or create a new Media instance.

Form handler the edit() action and the MediaForm.

Redirects back to edit() after successful editing and index() after successful deletion.

save_thumb(*args, **kwargs)

Save a thumbnail uploaded with ThumbForm.

Parameters:
  • id (int or "new") – Media ID. If "new" a new Media stub is created.
  • file (cgi.FieldStorage or None) – The uploaded file
Return type:

JSON dict

Returns:

success

bool

message

Error message, if unsuccessful

id

The id which is important if a new media has just been created.

update_status(*args, **kwargs)

Update the publish status for the given media.

Parameters:
Return type:

JSON dict

Returns:

success

bool

message

Error message, if unsuccessful

status_form

Rendered XHTML for the status form, updated to reflect the changes made.

Podcasts

class mediadrop.controllers.admin.podcasts.PodcastsController(*args, **kwargs)
allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130fcb6950>
edit(*args, **kwargs)

Display the podcast forms for editing or adding.

This page serves as the error_handler for every kind of edit action, if anything goes wrong with them they’ll be redirected here.

Parameters:
  • id (int or "new") – Podcast ID
  • **kwargs – Extra args populate the form for "new" podcasts
Returns:

podcast

Podcast instance

form

PodcastForm instance

form_action

str form submit url

form_values

dict form values

thumb_form

ThumbForm instance

thumb_action

str form submit url

index(*args, **kwargs)

List podcasts with pagination.

Parameters:page (int) – Page number, defaults to 1.
Return type:Dict
Returns:
podcasts
The list of Podcast instances for this page.
save(*args, **kwargs)

Save changes or create a new Podcast instance.

Form handler the edit() action and the PodcastForm.

Redirects back to edit() after successful editing and index() after successful deletion.

save_thumb(*args, **kwargs)

Save a thumbnail uploaded with ThumbForm.

Parameters:
  • id (int or "new") – Media ID. If "new" a new Podcast stub is created.
  • file (cgi.FieldStorage or None) – The uploaded file
Return type:

JSON dict

Returns:

success

bool

message

Error message, if unsuccessful

id

The id which is important if a new podcast has just been created.

Comments

Comment Moderation Controller

class mediadrop.controllers.admin.comments.CommentsController(*args, **kwargs)
allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130feb3950>
index(*args, **kwargs)

List comments with pagination and filtering.

Parameters:
  • page (int) – Page number, defaults to 1.
  • search (unicode or None) – Optional search term to filter by
  • media_filter (int or None) – Optional media ID to filter by
Return type:

dict

Returns:

comments

The list of Comment instances for this page.

edit_form

The mediadrop.forms.admin.comments.EditCommentForm instance, to be rendered for each instance in comments.

search

The given search term, if any

search_form

The SearchForm instance

media_filter

The given podcast ID to filter by, if any

media_filter_title

The media title for rendering if a media_filter was specified.

save_edit(*args, **kwargs)

Save an edit from EditCommentForm.

Parameters:id (int) – Comment ID
Return type:JSON dict
Returns:
success
bool
body
The edited comment body after validation/filtering
save_status(*args, **kwargs)

Approve or delete a comment or comments.

Parameters:
  • id (int or "bulk") – A id if we are acting on a single comment, or "bulk" if we should refer to ids.
  • status"approve" or "trash" depending on what action the user requests.
  • ids (unicode or None) – An optional string of IDs separated by commas.
Return type:

JSON dict

Returns:

success

bool

ids

A list of id that have changed.

User Management

class mediadrop.controllers.admin.users.UsersController(*args, **kwargs)

Admin user actions

allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130ff33d10>
delete(*args, **kwargs)

Delete a user.

Parameters:id (int) – User ID.
Returns:Redirect back to index() after successful delete.
edit(*args, **kwargs)

Display the UserForm for editing or adding.

Parameters:id (int or "new") – User ID
Return type:dict
Returns:
user
The User instance we’re editing.
user_form
The UserForm instance.
user_action
str form submit url
user_values
dict form values
index(*args, **kwargs)

List users with pagination.

Parameters:page (int) – Page number, defaults to 1.
Return type:Dict
Returns:
users
The list of User instances for this page.
save(*args, **kwargs)

Save changes or create a new User instance.

Parameters:id (int or "new") – User ID. If "new" a new user is created.
Returns:Redirect back to index() after successful save.

Settings - Audio/Video Players

class mediadrop.controllers.admin.players.PlayersController(*args, **kwargs)

Admin player preference actions

allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130f7bff10>
delete(*args, **kwargs)

Delete a PlayerPref.

After deleting the PlayerPref, cleans up the players table, ensuring that each Player class is represented–if the deleted PlayerPref is the last example of that Player class, creates a new disabled PlayerPref for that Player class with the default settings.

Parameters:id (int) – Player ID.
Returns:Redirect back to index() after successful delete.
disable(*args, **kwargs)

Disable a PlayerPref.

Parameters:id (int) – Player ID.
Returns:Redirect back to index() after success.
edit(*args, **kwargs)

Display the PlayerPrefs for editing or adding.

Parameters:id (int or "new") – PlayerPrefs ID
Return type:dict
Returns:
enable(*args, **kwargs)

Enable a PlayerPref.

Parameters:id (int) – Player ID.
Returns:Redirect back to index() after success.
index(*args, **kwargs)

List players.

Return type:Dict
Returns:
players
The list of PlayerPrefs instances for this page.
reorder(*args, **kwargs)

Reorder a PlayerPref.

Parameters:
  • id (int) – Player ID.
  • direction (unicode) – "up" for higher priority, "down" for lower priority
Returns:

Redirect back to index() after success.

save(*args, **kwargs)

Settings - Storage Engines

class mediadrop.controllers.admin.storage.StorageController(*args, **kwargs)

Admin storage engine actions

allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130f68bbd0>
delete(*args, **kwargs)

Delete a StorageEngine.

Parameters:id (int) – Storage ID.
Returns:Redirect back to index() after successful delete.
disable(*args, **kwargs)

Disable a StorageEngine.

Parameters:id (int) – engine ID.
Returns:Redirect back to index() after success.
edit(*args, **kwargs)

Display the StorageEngine for editing or adding.

Parameters:id (int or "new") – Storage ID
Return type:dict
Returns:
enable(*args, **kwargs)

Enable a StorageEngine.

Parameters:id (int) – Storage ID.
Returns:Redirect back to index() after success.
fetch_engine(id, engine_type=None)
index(*args, **kwargs)

List storage engines with pagination.

Return type:Dict
Returns:
engines
The list of StorageEngine instances for this page.
save(*args, **kwargs)

Settings - Categories

class mediadrop.controllers.admin.categories.CategoriesController(*args, **kwargs)
allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130f636f50>
bulk(*args, **kwargs)

Perform bulk operations on media items

Parameters:
  • type – The type of bulk action to perform (delete)
  • ids – A list of IDs.
edit(*args, **kwargs)

Edit a single category.

Parameters:id – Category ID
Return type:Dict
Returns:
categories
The list of Category instances for this page.
category_form
The CategoryForm instance.
index(*args, **kwargs)

List categories.

Return type:Dict
Returns:
categories
The list of Category instances for this page.
category_form
The CategoryForm instance.
save(*args, **kwargs)

Save changes or create a category.

See CategoryForm for POST vars.

Parameters:
  • id – Category ID
  • delete (bool) – If true the category is to be deleted rather than saved.
Return type:

JSON dict

Returns:

success

bool

Settings - Tags

class mediadrop.controllers.admin.tags.TagsController(*args, **kwargs)
allow_only = <mediadrop.lib.auth.pylons_glue.has_permission object at 0x7f130f537f90>
bulk(*args, **kwargs)

Perform bulk operations on media items

Parameters:
  • type – The type of bulk action to perform (delete)
  • ids – A list of IDs.
edit(*args, **kwargs)

Edit a single tag.

Parameters:id – Tag ID
Return type:Dict
Returns:
tags
The list of Tag instances for this page.
tag_form
The TagForm instance.
index(*args, **kwargs)

List tags with pagination.

Parameters:page (int) – Page number, defaults to 1.
Return type:Dict
Returns:
tags
The list of Tag instances for this page.
tag_form
The TagForm instance.
save(*args, **kwargs)

Save changes or create a tag.

See TagForm for POST vars.

Parameters:id – Tag ID
Return type:JSON dict
Returns:
success
bool

Settings - Other

class mediadrop.controllers.admin.settings.SettingsController(*args, **kwargs)

Dumb controller for display and saving basic settings forms.

See mediadrop.lib.base.BaseSettingsController for more details.

advertising(*args, **kwargs)
advertising_save(*args, **kwargs)

Save AdvertisingForm.

analytics(*args, **kwargs)
analytics_save(*args, **kwargs)

Save AnalyticsForm.

api(*args, **kwargs)
appearance(*args, **kwargs)
appearance_save(*args, **kwargs)

Save appearanceForm.

comments(*args, **kwargs)
comments_save(*args, **kwargs)

Save CommentsForm.

general(*args, **kwargs)
general_save(*args, **kwargs)

Save GeneralForm.

index(**kwargs)
notifications(*args, **kwargs)
notifications_save(*args, **kwargs)

Save NotificationsForm.

popularity(*args, **kwargs)
popularity_save(*args, **kwargs)

Save PopularityForm.

Updates the popularity for every media item based on the submitted values.

save_api(*args, **kwargs)

Save APIForm.

sitemaps(*args, **kwargs)
sitemaps_save(*args, **kwargs)

Save SiteMapsForm.

upload(*args, **kwargs)
upload_save(*args, **kwargs)

Save UploadForm.

You're reading the documentation for MediaDrop 0.11dev (current git master). For the latest stable release please consult the documentation for MediaCore CE 0.10.