~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/submit/__init__.py

  • Committer: William Grant
  • Date: 2009-12-08 03:50:24 UTC
  • mfrom: (1294.2.143 ui-the-third)
  • Revision ID: grantw@unimelb.edu.au-20091208035024-wjx8zp54gth15ph8
Merge ui-the-third. This is another UI revamp.

The header is now thin! Thin! The yellow bar is gone. The tabs are gone.
Breadcrumbs are here. Routes is replaced (with an object publishing
mechanism). Views are less repetitive. etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from ivle.webapp.errors import NotFound, BadRequest
30
30
from ivle.webapp.base.xhtml import XHTMLView
31
31
from ivle.webapp.base.plugins import ViewPlugin
 
32
from ivle.webapp import ApplicationRoot
32
33
 
33
34
import ivle.date
34
35
import ivle.chat
39
40
    template = 'submit.html'
40
41
    tab = 'files'
41
42
    permission = 'submit_project'
42
 
 
43
 
    def __init__(self, req, name, path=u"/"):
 
43
    subpath_allowed = True
 
44
 
 
45
    def __init__(self, req, context, subpath):
 
46
        super(SubmitView, self).__init__(req, context, subpath)
 
47
 
 
48
        if len(subpath) < 1:
 
49
            raise NotFound()
 
50
        name = subpath[0]
44
51
        # We need to work out which entity owns the repository, so we look
45
52
        # at the first two path segments. The first tells us the type.
46
53
        self.context = self.get_repository_owner(req.store, name)
47
54
 
48
 
        # Ensure that the path is absolute (required for SVNAuthzFile).
49
 
        # XXX Re-convert to unicode (os.path.normpath(u"/") returns a str).
50
 
        self.path = os.path.join(u"/", unicode(os.path.normpath(path)))
51
 
 
52
55
        if self.context is None:
53
56
            raise NotFound()
54
57
 
130
133
        ctx['now'] = datetime.datetime.now()
131
134
        ctx['format_datetime'] = ivle.date.make_date_nice
132
135
        ctx['format_datetime_short'] = ivle.date.format_datetime_for_paragraph
 
136
    
 
137
    @property
 
138
    def path(self):
 
139
        return os.path.join('/', *self.subpath[1:]) if self.subpath else '/'
133
140
 
134
141
 
135
142
class UserSubmitView(SubmitView):
173
180
 
174
181
 
175
182
class Plugin(ViewPlugin):
176
 
    urls = [
177
 
        ('+submit/users/:name', UserSubmitView),
178
 
        ('+submit/groups/:name', GroupSubmitView),
179
 
        ('+submit/users/:name/*path', UserSubmitView),
180
 
        ('+submit/groups/:name/*path', GroupSubmitView),
181
 
    ]
 
183
    views = [(ApplicationRoot, ('+submit', 'users'), UserSubmitView),
 
184
             (ApplicationRoot, ('+submit', 'groups'), GroupSubmitView)]
 
185