Exemple #1
0
def setup_project(name):
    """
    Helper for build_app_list to prepare the process for settings of a given
    Pinax project.
    """
    settings_mod = import_module("%s.settings" % name)
    setup_environ(settings_mod)
Exemple #2
0
from pinax.utils.importlib import import_module

from tagging.models import Tag
from django.utils.translation import ugettext

# Only import dpaste Snippet Model if it's activated
if 'dpaste' in getattr(settings, 'INSTALLED_APPS', []):
    from dpaste.models import Snippet
else:
    Snippet = False

from tasks.models import Task, TaskHistory, Nudge
from tasks.filters import TaskFilter
from tasks.forms import TaskForm, EditTaskForm, SearchTaskForm

workflow = import_module(getattr(settings, "TASKS_WORKFLOW_MODULE", "tasks.workflow"))

try:
    notification = get_app('notification')
except ImproperlyConfigured:
    notification = None


def tasks(request, group_slug=None, template_name="tasks/task_list.html", bridge=None):
    
    if bridge:
        try:
            group = bridge.get_group(group_slug)
        except ObjectDoesNotExist:
            raise Http404
    else:
Exemple #3
0
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic

from django.contrib.auth.models import User

from pinax.utils.importlib import import_module

from tagging.fields import TagField
from tagging.models import Tag

if "notification" in settings.INSTALLED_APPS:
    from notification import models as notification
else:
    notification = None

workflow = import_module(
    getattr(settings, "TASKS_WORKFLOW_MODULE", "tasks.workflow"))


class Task(models.Model):
    """
    a task to be performed.
    """

    STATE_CHOICES = workflow.STATE_CHOICES
    RESOLUTION_CHOICES = workflow.RESOLUTION_CHOICES
    REVERSE_STATE_CHOICES = workflow.REVERSE_STATE_CHOICES

    content_type = models.ForeignKey(ContentType, null=True, blank=True)
    object_id = models.PositiveIntegerField(null=True, blank=True)
    group = generic.GenericForeignKey("content_type", "object_id")
IM_CHAT_POLL_EVERY = define("IM_POLL_EVERY", timedelta(seconds=5))
IM_CHATBOX_POLL_EVERY = define("IM_POLL_EVERY", timedelta(seconds=10))
IM_USERLIST_POLL_EVERY = define("IM_POLL_EVERY",
                                IM_CHATBOX_POLL_EVERY * 10)

IM_EMOTICONS_ROOT = define("IM_EMOTICONS_ROOT",
                           os.path.join(settings.PROJECT_ROOT,
                                        "media", "images", "emoticons"))

IM_EMOTICONS_URL = define("IM_EMOTICONS_URL",
                          posixpath.join(settings.STATIC_URL,
                                         "images", "emoticons"))

IM_EMOTICONS_THEME = define("IM_EMOTICONS_THEME", "16px_emoticons")

IM_EMOTICONS_TEMPLATE = u"<img src=\"%s/%%s\" alt=\"%%s\" />" \
                        % posixpath.join(IM_EMOTICONS_URL, IM_EMOTICONS_THEME)

sys.path.append(IM_EMOTICONS_ROOT)

# Trying to import the setup theme.
try:
    module = import_module(IM_EMOTICONS_THEME)
    theme = getattr(module, "theme")
except (ImportError, AttributeError), exc:
    IM_EMOTICONS_THEME = None
else:
    # Compiling the theme.
    IM_EMOTICONS_THEME = dict((name, re.compile(pattern)) \
                              for name, pattern in theme.iteritems())
IM_REQUESTS_EXPIRE_IN = define("IM_REQUESTS_EXPIRE_IN", timedelta(minutes=5))
IM_CHAT_POLL_EVERY = define("IM_POLL_EVERY", timedelta(seconds=5))
IM_CHATBOX_POLL_EVERY = define("IM_POLL_EVERY", timedelta(seconds=10))
IM_USERLIST_POLL_EVERY = define("IM_POLL_EVERY", IM_CHATBOX_POLL_EVERY * 10)

IM_EMOTICONS_ROOT = define(
    "IM_EMOTICONS_ROOT",
    os.path.join(settings.PROJECT_ROOT, "media", "images", "emoticons"))

IM_EMOTICONS_URL = define(
    "IM_EMOTICONS_URL",
    posixpath.join(settings.STATIC_URL, "images", "emoticons"))

IM_EMOTICONS_THEME = define("IM_EMOTICONS_THEME", "16px_emoticons")

IM_EMOTICONS_TEMPLATE = u"<img src=\"%s/%%s\" alt=\"%%s\" />" \
                        % posixpath.join(IM_EMOTICONS_URL, IM_EMOTICONS_THEME)

sys.path.append(IM_EMOTICONS_ROOT)

# Trying to import the setup theme.
try:
    module = import_module(IM_EMOTICONS_THEME)
    theme = getattr(module, "theme")
except (ImportError, AttributeError), exc:
    IM_EMOTICONS_THEME = None
else:
    # Compiling the theme.
    IM_EMOTICONS_THEME = dict((name, re.compile(pattern)) \
                              for name, pattern in theme.iteritems())