|
Last change
on this file since 17618 was
3492,
checked in by joachim, 19 years ago
|
|
fix traceback for anonymous users,
do not show log-message, when student views academic session.
|
|
File size:
950 bytes
|
| Line | |
|---|
| 1 | ## Script (Python) "getDocumentInfo" |
|---|
| 2 | ##bind container=container |
|---|
| 3 | ##bind context=context |
|---|
| 4 | ##bind namespace= |
|---|
| 5 | ##bind script=script |
|---|
| 6 | ##bind subpath=traverse_subpath |
|---|
| 7 | ##parameters=student=None |
|---|
| 8 | ##title= |
|---|
| 9 | ## |
|---|
| 10 | # $Id:getDocumentInfo.py 486 2006-09-06 10:09:39Z joachim $ |
|---|
| 11 | """ |
|---|
| 12 | return Info about a document |
|---|
| 13 | """ |
|---|
| 14 | try: |
|---|
| 15 | from Products.zdb import set_trace |
|---|
| 16 | except: |
|---|
| 17 | def set_trace(): |
|---|
| 18 | pass |
|---|
| 19 | |
|---|
| 20 | request = context.REQUEST |
|---|
| 21 | |
|---|
| 22 | #wf = context.portal_workflow |
|---|
| 23 | #path_info = request.get('PATH_INFO').split('/') |
|---|
| 24 | |
|---|
| 25 | # mtool = context.portal_membership |
|---|
| 26 | # if mtool.isAnonymousUser(): |
|---|
| 27 | # return None |
|---|
| 28 | |
|---|
| 29 | info = context.waeup_tool.getAccessInfo(context) |
|---|
| 30 | #set_trace() |
|---|
| 31 | |
|---|
| 32 | student_id = info['student_id'] |
|---|
| 33 | # if not info['is_staff'] and student_id is None: |
|---|
| 34 | # return info |
|---|
| 35 | #return None |
|---|
| 36 | |
|---|
| 37 | titles = context.getStudentObjectTitles() |
|---|
| 38 | info['title'] = titles.get(context.portal_type,'') or context.title_or_id |
|---|
| 39 | try: |
|---|
| 40 | info['doc'] = context.getContent() |
|---|
| 41 | except: |
|---|
| 42 | return None |
|---|
| 43 | return info |
|---|
| 44 | |
|---|
Note: See
TracBrowser for help on using the repository browser.