From 5c9149641da68bb0a718c6458e3387e20fe3bf76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 16 Mar 2013 18:46:34 +0100 Subject: [PATCH] add docstrings in a bunch of places --- univcloud/apps/__init__.py | 1 + univcloud/apps/add.py | 3 +++ univcloud/apps/base.py | 2 ++ univcloud/apps/clock.py | 3 +++ univcloud/apps/feed.py | 3 +++ univcloud/apps/help.py | 2 ++ univcloud/apps/launcher.py | 3 +++ univcloud/apps/weather.py | 3 +++ univcloud/apps/welcome.py | 3 +++ univcloud/profile/models.py | 4 ++++ univcloud/views.py | 8 +++++++- 11 files changed, 34 insertions(+), 1 deletion(-) diff --git a/univcloud/apps/__init__.py b/univcloud/apps/__init__.py index f12ea29..41fcafc 100644 --- a/univcloud/apps/__init__.py +++ b/univcloud/apps/__init__.py @@ -19,5 +19,6 @@ import importlib def create_app(app_id, app_name, kwargs): + '''Create an application object of the requested type''' module = importlib.import_module('univcloud.apps.%s' % app_name) return module.App(app_id, **kwargs) diff --git a/univcloud/apps/add.py b/univcloud/apps/add.py index 05cb67d..31d62e4 100644 --- a/univcloud/apps/add.py +++ b/univcloud/apps/add.py @@ -16,8 +16,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Add App''' + from .base import BaseApp class App(BaseApp): + '''Add App, used to add new apps to the portal''' app_id = 'add-app' template_name = 'apps/add.html' diff --git a/univcloud/apps/base.py b/univcloud/apps/base.py index 9abdc0e..774ed0a 100644 --- a/univcloud/apps/base.py +++ b/univcloud/apps/base.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Base class for Apps''' + from django.template.loader import render_to_string class BaseApp(object): diff --git a/univcloud/apps/clock.py b/univcloud/apps/clock.py index 88ae10f..6c3cd94 100644 --- a/univcloud/apps/clock.py +++ b/univcloud/apps/clock.py @@ -16,7 +16,10 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Clock App''' + from .base import BaseApp class App(BaseApp): + '''Clock App, used to display an analog clock''' template_name = 'apps/clock.html' diff --git a/univcloud/apps/feed.py b/univcloud/apps/feed.py index 1d5fb71..a8e1a53 100644 --- a/univcloud/apps/feed.py +++ b/univcloud/apps/feed.py @@ -16,9 +16,12 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Feed App''' + from .base import BaseApp class App(BaseApp): + '''Feed App, used to display a RSS feed''' app_id = 'feed-app' template_name = 'apps/feed.html' sizex = 2 diff --git a/univcloud/apps/help.py b/univcloud/apps/help.py index 6e6ca62..2d60281 100644 --- a/univcloud/apps/help.py +++ b/univcloud/apps/help.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Help App''' + from .base import BaseApp class App(BaseApp): diff --git a/univcloud/apps/launcher.py b/univcloud/apps/launcher.py index 504dd9c..8647487 100644 --- a/univcloud/apps/launcher.py +++ b/univcloud/apps/launcher.py @@ -16,9 +16,12 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Launcher App''' + from .base import BaseApp class App(BaseApp): + '''Launcher App, used to open a website full page''' template_name = 'apps/launcher.html' sizex = 2 sizey = 1 diff --git a/univcloud/apps/weather.py b/univcloud/apps/weather.py index 0698275..31bafdc 100644 --- a/univcloud/apps/weather.py +++ b/univcloud/apps/weather.py @@ -16,8 +16,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Weather App''' + from .base import BaseApp class App(BaseApp): + '''Weather App, used to display the current weather''' app_id = 'weather-app' template_name = 'apps/weather.html' diff --git a/univcloud/apps/welcome.py b/univcloud/apps/welcome.py index 61b3064..d3567ba 100644 --- a/univcloud/apps/welcome.py +++ b/univcloud/apps/welcome.py @@ -16,9 +16,12 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Welcome App''' + from .base import BaseApp class App(BaseApp): + '''Welcome App, used to display an informational message to users''' template_name = 'apps/welcome.html' sizex = 2 sizey = 2 diff --git a/univcloud/profile/models.py b/univcloud/profile/models.py index 28c42f2..0ab2e83 100644 --- a/univcloud/profile/models.py +++ b/univcloud/profile/models.py @@ -22,6 +22,10 @@ from django.contrib.auth.models import User from django.db import models class UserProfile(models.Model): + '''User Profile Model + + Stores the portal layout configuration, as json, in the layout field + ''' user = models.OneToOneField(User) layout = models.CharField(max_length=10000) diff --git a/univcloud/views.py b/univcloud/views.py index e6a0231..be314bc 100644 --- a/univcloud/views.py +++ b/univcloud/views.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +'''Views for displaying and manipulating the homepage''' + import json import random @@ -28,6 +30,7 @@ from profile.models import UserProfile from . import apps class Homepage(TemplateView): + '''Homepage View, displays a serie of apps''' template_name = 'univcloud/homepage.html' def get_context_data(self, **kwargs): @@ -61,6 +64,7 @@ homepage = login_required(Homepage.as_view()) class Add(RedirectView): + '''Add View, used to add a new application to the portal''' def get_redirect_url(self, appid): profile = self.request.user.get_profile() layout = profile.get_layout() @@ -72,6 +76,7 @@ add = login_required(Add.as_view()) class Dragstop(RedirectView): + '''Drag stop View, used to register the new position of an app''' def get_redirect_url(self): profile = self.request.user.get_profile() layout = profile.get_layout() @@ -90,6 +95,7 @@ dragstop = login_required(Dragstop.as_view()) class Remove(RedirectView): + '''Remove View, used to remove an app from the portal''' def get_redirect_url(self, app_id): profile = self.request.user.get_profile() layout = profile.get_layout() @@ -101,8 +107,8 @@ class Remove(RedirectView): remove = login_required(Remove.as_view()) - class Color(RedirectView): + '''Color View, used to set a new background color''' def get_redirect_url(self, app_id): profile = self.request.user.get_profile() layout = profile.get_layout()