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

« back to all changes in this revision

Viewing changes to ivle/webapp/tutorial/breadcrumbs.py

  • Committer: David Coles
  • Date: 2010-08-30 03:26:13 UTC
  • Revision ID: coles.david@gmail.com-20100830032613-d14vng0jkelniu3l
python-console: Fix globals broken with new JSON library.

simplejson always returns unicode strings. cJSON would return ordinary strings 
if possible. cPickle.loads() only accepts strings. At present we use pickle 
version 0 so they should all works as ASCII strings. Higher versions of pickle 
are not plain ASCII and are likely to break this and so this should be fixed 
at some point.

Also replaced unconditional exception with one that catches Pickle errors. Not 
sure the best way to report failures of these functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
 
18
class ExercisesBreadcrumb(object):
 
19
    @property
 
20
    def url(self):
 
21
        return '/+exercises'
 
22
 
 
23
    @property
 
24
    def text(self):
 
25
        return 'Exercises'
 
26
 
 
27
 
18
28
class ExerciseBreadcrumb(object):
19
29
    def __init__(self, req, context):
20
30
        self.req = req
22
32
 
23
33
    @property
24
34
    def url(self):
25
 
        return self.req.publisher.generate(self.context, None, '+edit')
 
35
        return self.req.publisher.generate(self.context)
26
36
 
27
37
    @property
28
38
    def text(self):
29
39
        return self.context.name
30
40
 
 
41
    @property
 
42
    def extra_breadcrumbs_before(self):
 
43
        return [ExercisesBreadcrumb()]
 
44
 
 
45
 
31
46
class WorksheetBreadcrumb(object):
32
47
    def __init__(self, req, context):
33
48
        self.req = req