Задача

Сделать доступным веб-расписание.

Варианты

  1. Ручная правка кода составляющим расписание, последующий рендер таблицы.
  2. Составление расписание на стороне университета в привычном формате (предпочтительно xls-like), парсинг на стороне вики, составление таблицы.
  3. Формы с drop-down списками предметов (определенных по принадлежности к категории "Предмет"), последующий рендер таблицы.

Требования

  1. Просмотр событий всей недели на одной странице
  2. В строках -- номера пар, в столбцах -- дни.
  3. Возможность смены отображаемой недели
  4. Автоматический показ текущей недели
  5. 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.

  1. /usr/lib/pymodules/python2.6/MoinMoin/request/__init__.py in run (self=<MoinMoin.request.request_cgi.Request object>)

    1. 1309 self.page.send_page()
    2. 1310 else:
    3. 1311 handler(self.page.page_name, self)
    4. 1312
    5. 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'
  2. /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)

    1. 251 count_hit=count_hit,
    2. 252 print_mode=print_mode,
    3. 253 content_only=content_only,
    4. 254 )
    5. 255
    • content_only = 0
  3. /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})

    1. 1195 format_args=pi['formatargs'],
    2. 1196 do_cache=do_cache,
    3. 1197 start_line=pi['lines'])
    4. 1198
    5. 1199 # check for pending footnotes
    • start_line undefined
    • pi = {'acl': <MoinMoin.security.AccessControlList instance>, 'format': 'wiki', 'formatargs': '', 'language': 'ru', 'lines': 1}
  4. /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})

    1. 1283 try:
    2. 1284 code = self.loadCache(request)
    3. 1285 self.execute(request, parser, code)
    4. 1286 except Exception, e:
    5. 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>
  5. /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>)

    1. 1314 __file__ = os.path.join(MoinMoin.__loader__.archive, 'dummy')
    2. 1315 try:
    3. 1316 exec code
    4. 1317 except "CacheNeedsUpdate": # convert the exception
    5. 1318 raise Exception("CacheNeedsUpdate")
    • code = <code object <module> at 0x9161260, file "Сервис/ToDo/Расписание", line 2>
  6. /srv/www/philosophy.ungrund.org/moinmoin/cgi-bin/Сервис/ToDo/Расписание in ()

  7. /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>>')

    1. 312 # call the macro
    2. 313 try:
    3. 314 return macro_obj.execute(name, args)
    4. 315 except ImportError, err:
    5. 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
  8. /usr/lib/pymodules/python2.6/MoinMoin/macro/__init__.py in execute (self=<MoinMoin.macro.Macro instance>, macro_name=u'EventCalendar', args=None)

    1. 126 else:
    2. 127 raise ImportError("Cannot load macro %s" % macro_name)
    3. 128 return execute(self, args)
    4. 129
    5. 130 def _m_lang(self, text):
    • execute = <function execute>
    • self = <MoinMoin.macro.Macro instance>
    • args = None
  9. /srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in execute (macro=<MoinMoin.macro.Macro instance>, args=None)

    1. 279 # redirect to the appropriate view
    2. 280 if cal_action == 'monthly':
    3. 281 html_result = showcalendar()
    4. 282
    5. 283 if cal_action == 'list':
    • html_result = ''
    • global showcalendar = <function showcalendar>
  10. /srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in showcalendar ()

    1. 907 cyear, cmonth = yearmonthplusoffset(year, month, index)
    2. 908
    3. 909 cal_html = showeventcalendar(cyear, cmonth)
    4. 910 html.append(cal_html)
    5. 911
    • cal_html undefined
    • global showeventcalendar = <function showeventcalendar>
    • cyear = 2012
    • cmonth = 5
  11. /srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in showeventcalendar (year=2012, month=5)

    1. 2468
    2. 2469 # read all the events
    3. 2470 events, cal_events, labels = loadEvents(datefrom, dateto)
    4. 2471
    5. 2472 #debug(u' events: %s' % events)
    • events undefined
    • cal_events undefined
    • labels undefined
    • global loadEvents = <function loadEvents>
    • datefrom = u'20120421'
    • dateto = u'20120606'
  12. /srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in loadEvents (datefrom=u'20120421', dateto=u'20120606', nocache=0)

    1. 1067 raw_events = {}
    2. 1068
    3. 1069 raw_events, labels = loadEventsFromWikiPages()
    4. 1070
    5. 1071 # handling cal_events
    • raw_events = {}
    • labels = {}
    • global loadEventsFromWikiPages = <function loadEventsFromWikiPages>
  13. /srv/www/philosophy.ungrund.org/moinmoin/data/plugin/macro/EventCalendar.py in loadEventsFromWikiPages ()

    1. 1397 errmsglistkey = 'eventcalerrormsglist'
    2. 1398
    3. 1399 cache_events = caching.CacheEntry(request, arena, eventkey)
    4. 1400 cache_labels = caching.CacheEntry(request, arena, labelkey)
    5. 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'
  14. /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)

    1. 65 self.use_pickle = use_pickle
    2. 66 self.use_encode = use_encode
    3. 67 self.arena_dir = get_arena_dir(request, arena, scope)
    4. 68 if not os.path.exists(self.arena_dir):
    5. 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'
  15. /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')

    1. 30 return arena.getPagePath('cache', check_create=1)
    2. 31 elif scope == 'wiki':
    3. 32 return os.path.join(request.cfg.cache_dir, request.cfg.siteid, arena)
    4. 33 elif scope == 'farm':
    5. 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>
  16. /usr/lib/python2.6/posixpath.py in join (a='/srv/www/philosophy.ungrund.org/moinmoin/data/cache', *p=('philosophy', <MoinMoin.Page.Page object>))

    1. 63 path = a
    2. 64 for b in p:
    3. 65 if b.startswith('/'):
    4. 66 path = b
    5. 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)