Задача
Сделать доступным веб-расписание.
Варианты
- Ручная правка кода составляющим расписание, последующий рендер таблицы.
- Составление расписание на стороне университета в привычном формате (предпочтительно xls-like), парсинг на стороне вики, составление таблицы.
- Формы с drop-down списками предметов (определенных по принадлежности к категории "Предмет"), последующий рендер таблицы.
Требования
- Просмотр событий всей недели на одной странице
- В строках -- номера пар, в столбцах -- дни.
- Возможность смены отображаемой недели
- Автоматический показ текущей недели
- Day-based формат в случае ручной правки кода
Примеры
1. Макрос <<MonthCalendar>>
| << < 2012 / 5 > >> | ||||||
|---|---|---|---|---|---|---|
| Пн | Вт | Ср | Чт | Пт | Сб | Вс |
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||
Не удовлетворяет требованиям: 1, 2, (?)5.
2. Макрос <<EventCalendar>>
--> -->
AttributeError
'Page' object has no attribute 'startswith'
If you want to report a bug, please save this page and attach it to your bug report.
Traceback
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/usr/lib/pymodules/python2.6/MoinMoin/request/__init__.py in run (self=<MoinMoin.request.request_cgi.Request object>)
- 1309 self.page.send_page()
- 1310 else:
- 1311 handler(self.page.page_name, self)
- 1312
- 1313 # every action that didn't use to raise MoinMoinFinish must call this now:
- handler = <function do_show>
- self = <MoinMoin.request.request_cgi.Request object>
- self.page = <MoinMoin.Page.Page object>
- self.page.page_name = u'\u0421\u0435\u0440\u0432\u0438\u0441/ToDo/\u0420\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435'
/usr/lib/pymodules/python2.6/MoinMoin/action/__init__.py in do_show (pagename=u'\u0421\u0435\u0440\u0432\u0438\u0441/ToDo/\u0420\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435', request=<MoinMoin.request.request_cgi.Request object>, content_only=0, count_hit=1, cacheable=1, print_mode=0)
- 251 count_hit=count_hit,
- 252 print_mode=print_mode,
- 253 content_only=content_only,
- 254 )
- 255
- content_only = 0
/usr/lib/pymodules/python2.6/MoinMoin/Page.py in send_page (self=<MoinMoin.Page.Page object>, **keywords={'content_only': 0, 'count_hit': 1, 'print_mode': 0})
- 1195 format_args=pi['formatargs'],
- 1196 do_cache=do_cache,
- 1197 start_line=pi['lines'])
- 1198
- 1199 # check for pending footnotes
- start_line undefined
- pi = {'acl': <MoinMoin.security.AccessControlList instance>, 'format': 'wiki', 'formatargs': '', 'language': 'ru', 'lines': 1}
/usr/lib/pymodules/python2.6/MoinMoin/Page.py in send_page_content (self=<MoinMoin.Page.Page object>, request=<MoinMoin.request.request_cgi.Request object>, body=u"\n=== \u0417\u0430\u0434\u0430\u0447\u0430 ===\n\n\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0432\u0435\u0431-\u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438...\u0438\u0441\u0430\u043d\u0438\u0435\n\n'''\u041d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c:''' 3, 4\n", format='wiki', format_args='', do_cache=1, **kw={'start_line': 1})
- 1283 try:
- 1284 code = self.loadCache(request)
- 1285 self.execute(request, parser, code)
- 1286 except Exception, e:
- 1287 if not is_cache_exception(e):
- self = <MoinMoin.Page.Page object>
- self.execute = <bound method Page.execute of <MoinMoin.Page.Page object>>
- request = <MoinMoin.request.request_cgi.Request object>
- parser = <MoinMoin.parser.text_moin_wiki.Parser instance>
- code = <code object <module> at 0x9161260, file "Сервис/ToDo/Расписание", line 2>
/usr/lib/pymodules/python2.6/MoinMoin/Page.py in execute (self=<MoinMoin.Page.Page object>, request=<MoinMoin.request.request_cgi.Request object>, parser=<MoinMoin.parser.text_moin_wiki.Parser instance>, code=<code object <module> at 0x9161260, file "Сервис/ToDo/Расписание", line 2>)
- 1314 __file__ = os.path.join(MoinMoin.__loader__.archive, 'dummy')
- 1315 try:
- 1316 exec code
- 1317 except "CacheNeedsUpdate": # convert the exception
- 1318 raise Exception("CacheNeedsUpdate")
- code = <code object <module> at 0x9161260, file "Сервис/ToDo/Расписание", line 2>
/srv/www/philosophy.ungrund.org/moinmoin/cgi-bin/Сервис/ToDo/Расписание in
() /usr/lib/pymodules/python2.6/MoinMoin/formatter/__init__.py in macro (self=<MoinMoin.formatter.text_html.Formatter instance>, macro_obj=<MoinMoin.macro.Macro instance>, name=u'EventCalendar', args=None, markup=u'<<EventCalendar>>')
- 312 # call the macro
- 313 try:
- 314 return macro_obj.execute(name, args)
- 315 except ImportError, err:
- 316 errmsg = unicode(err)
- macro_obj = <MoinMoin.macro.Macro instance>
- macro_obj.execute = <bound method Macro.execute of <MoinMoin.macro.Macro instance>>
- name = u'EventCalendar'
- args = None
/usr/lib/pymodules/python2.6/MoinMoin/macro/__init__.py in execute (self=<MoinMoin.macro.Macro instance>, macro_name=u'EventCalendar', args=None)
- 126 else:
- 127 raise ImportError("Cannot load macro %s" % macro_name)
- 128 return execute(self, args)
- 129
- 130 def _m_lang(self, text):
- execute = <function execute>
- self = <MoinMoin.macro.Macro instance>
- args = None
/srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in execute (macro=<MoinMoin.macro.Macro instance>, args=None)
- 279 # redirect to the appropriate view
- 280 if cal_action == 'monthly':
- 281 html_result = showcalendar()
- 282
- 283 if cal_action == 'list':
- html_result = ''
- global showcalendar = <function showcalendar>
/srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in showcalendar ()
- 907 cyear, cmonth = yearmonthplusoffset(year, month, index)
- 908
- 909 cal_html = showeventcalendar(cyear, cmonth)
- 910 html.append(cal_html)
- 911
- cal_html undefined
- global showeventcalendar = <function showeventcalendar>
- cyear = 2012
- cmonth = 5
/srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in showeventcalendar (year=2012, month=5)
- 2468
- 2469 # read all the events
- 2470 events, cal_events, labels = loadEvents(datefrom, dateto)
- 2471
- 2472 #debug(u' events: %s' % events)
- events undefined
- cal_events undefined
- labels undefined
- global loadEvents = <function loadEvents>
- datefrom = u'20120421'
- dateto = u'20120606'
/srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in loadEvents (datefrom=u'20120421', dateto=u'20120606', nocache=0)
- 1067 raw_events = {}
- 1068
- 1069 raw_events, labels = loadEventsFromWikiPages()
- 1070
- 1071 # handling cal_events
- raw_events = {}
- labels = {}
- global loadEventsFromWikiPages = <function loadEventsFromWikiPages>
/srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in loadEventsFromWikiPages ()
- 1397 errmsglistkey = 'eventcalerrormsglist'
- 1398
- 1399 cache_events = caching.CacheEntry(request, arena, eventkey)
- 1400 cache_labels = caching.CacheEntry(request, arena, labelkey)
- 1401 cache_pages = caching.CacheEntry(request, arena, pagelistkey)
- cache_events undefined
- global caching = <module 'MoinMoin.caching' from '/usr/lib/pymodules/python2.6/MoinMoin/caching.pyc'>
- caching.CacheEntry = <class MoinMoin.caching.CacheEntry>
- request = <MoinMoin.request.request_cgi.Request object>
- arena = <MoinMoin.Page.Page object>
- eventkey = 'events'
/usr/lib/pymodules/python2.6/MoinMoin/caching.py in __init__ (self=<MoinMoin.caching.CacheEntry instance>, request=<MoinMoin.request.request_cgi.Request object>, arena=<MoinMoin.Page.Page object>, key='events', scope='wiki', do_locking=True, use_pickle=False, use_encode=False)
- 65 self.use_pickle = use_pickle
- 66 self.use_encode = use_encode
- 67 self.arena_dir = get_arena_dir(request, arena, scope)
- 68 if not os.path.exists(self.arena_dir):
- 69 os.makedirs(self.arena_dir)
- self = <MoinMoin.caching.CacheEntry instance>
- self.arena_dir undefined
- global get_arena_dir = <function get_arena_dir>
- request = <MoinMoin.request.request_cgi.Request object>
- arena = <MoinMoin.Page.Page object>
- scope = 'wiki'
/usr/lib/pymodules/python2.6/MoinMoin/caching.py in get_arena_dir (request=<MoinMoin.request.request_cgi.Request object>, arena=<MoinMoin.Page.Page object>, scope='wiki')
- 30 return arena.getPagePath('cache', check_create=1)
- 31 elif scope == 'wiki':
- 32 return os.path.join(request.cfg.cache_dir, request.cfg.siteid, arena)
- 33 elif scope == 'farm':
- 34 return os.path.join(request.cfg.cache_dir, '__common__', arena)
- global os = <module 'os' from '/usr/lib/python2.6/os.pyc'>
- os.path = <module 'posixpath' from '/usr/lib/python2.6/posixpath.pyc'>
- os.path.join = <function join>
- request = <MoinMoin.request.request_cgi.Request object>
- request.cfg = <philosophy.Config object>
- request.cfg.cache_dir = '/srv/www/philosophy.ungrund.org/moinmoin/data/cache'
- request.cfg.siteid = 'philosophy'
- arena = <MoinMoin.Page.Page object>
/usr/lib/python2.6/posixpath.py in join (a='/srv/www/philosophy.ungrund.org/moinmoin/data/cache', *p=('philosophy', <MoinMoin.Page.Page object>))
- 63 path = a
- 64 for b in p:
- 65 if b.startswith('/'):
- 66 path = b
- 67 elif path == '' or path.endswith('/'):
- b = <MoinMoin.Page.Page object>
- b.startswith undefined
AttributeError
'Page' object has no attribute 'startswith'
- args = ("'Page' object has no attribute 'startswith'",)
- message = "'Page' object has no attribute 'startswith'"
System Details
- Date: Tue, 22 May 2012 05:34:17 +0000
- Platform: Linux betelgeuse 2.6.25-2-686 #1 SMP Fri Jul 18 17:46:56 UTC 2008 i686
- Python: Python 2.6.6 (/usr/bin/python)
- MoinMoin: Release 1.8.1 (release)
