rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
to_locale(person_info.first_name))
to_wx(person_info.first_name))
def __init__(self, parent, client, person): self.title = to_locale(person.person_title) self.person_path = person.person_path self.client = client self.mainframe = parent self.ok = False
to_locale(person_info.last_name))
to_wx(person_info.last_name))
def __init__(self, parent, client, person): self.title = to_locale(person.person_title) self.person_path = person.person_path self.client = client self.mainframe = parent self.ok = False
self.comments_ctrl = wxTextCtrl(self, -1, to_locale(person_info.comment),
self.comments_ctrl = wxTextCtrl(self, -1, to_wx(person_info.comment),
def __init__(self, parent, client, person): self.title = to_locale(person.person_title) self.person_path = person.person_path self.client = client self.mainframe = parent self.ok = False
person_info = PersonInfo(from_locale(self.first_name_ctrl.GetValue()), from_locale(self.last_name_ctrl.GetValue()), from_locale(self.date_of_birth_ctrl.GetValue()), from_locale(self.comments_ctrl.GetValue()))
person_info = PersonInfo(from_wx(self.first_name_ctrl.GetValue()), from_wx(self.last_name_ctrl.GetValue()), from_wx(self.date_of_birth_ctrl.GetValue()), from_wx(self.comments_ctrl.GetValue()))
def OnOk(self, event=None): person_info = PersonInfo(from_locale(self.first_name_ctrl.GetValue()), from_locale(self.last_name_ctrl.GetValue()), from_locale(self.date_of_birth_ctrl.GetValue()), from_locale(self.comments_ctrl.GetValue())) try: self.client.savePersonInfo(self.person_path, person_info) except SchoolToolErr...
title = from_locale(title)
title = from_wx(title)
def DoNewGroup(self, event): """Create a new group.
_("Add Member"), [to_locale(p[0]) for p in persons])
_("Add Member"), [to_wx(p[0]) for p in persons])
def DoAddMember(self, event): """Add a person to the current group.
[to_locale(p.person_title) for p in persons])
[to_wx(p.person_title) for p in persons])
def DoAddTeacher(self, event): """Add a teacher to the current group.
_("Add Subgroup"), [to_locale(g[0]) for g in groups])
_("Add Subgroup"), [to_wx(g[0]) for g in groups])
def DoAddSubgroup(self, event): """Add a subgroup to the current group.
% (to_locale(member.person_title), group_title),
% (to_wx(member.person_title), group_title),
def DoRemoveMember(self, event): """Remove a person from the current group.
% (to_locale(relationship.target_title), to_locale(nameURI(relationship.role)),
% (to_wx(relationship.target_title), to_wx(nameURI(relationship.role)),
def DoRemoveRelationship(self, event): """Remove a relationship.
self.SetStatusText(to_locale(unicode(e)))
self.SetStatusText(to_wx(unicode(e)))
def DoSelectGroup(self, event): """Update member and relationship lists for the selected group.
self.SetStatusText(to_locale(self.client.status))
self.SetStatusText(to_wx(self.client.status))
def DoSelectGroup(self, event): """Update member and relationship lists for the selected group.
self.personListCtrl.InsertStringItem(idx, to_locale(item.person_title))
self.personListCtrl.InsertStringItem(idx, to_wx(item.person_title))
def DoSelectGroup(self, event): """Update member and relationship lists for the selected group.
to_locale(item.target_title))
to_wx(item.target_title))
def DoSelectGroup(self, event): """Update member and relationship lists for the selected group.
to_locale(nameURI(item.role)))
to_wx(nameURI(item.role)))
def DoSelectGroup(self, event): """Update member and relationship lists for the selected group.
to_locale(nameURI(item.arcrole)))
to_wx(nameURI(item.arcrole)))
def DoSelectGroup(self, event): """Update member and relationship lists for the selected group.
self.SetStatusText(to_locale(unicode(e)))
self.SetStatusText(to_wx(unicode(e)))
def _refresh(self): # Get the tree from the server try: group_tree = self.client.getGroupTree() except SchoolToolError, e: self.SetStatusText(to_locale(unicode(e))) group_tree = [] else: self.SetStatusText(to_locale(self.client.status))
self.SetStatusText(to_locale(self.client.status))
self.SetStatusText(to_wx(self.client.status))
def _refresh(self): # Get the tree from the server try: group_tree = self.client.getGroupTree() except SchoolToolError, e: self.SetStatusText(to_locale(unicode(e))) group_tree = [] else: self.SetStatusText(to_locale(self.client.status))
item = self.groupTreeCtrl.AppendItem(stack[-1][0], to_locale(title))
item = self.groupTreeCtrl.AppendItem(stack[-1][0], to_wx(title))
def _refresh(self): # Get the tree from the server try: group_tree = self.client.getGroupTree() except SchoolToolError, e: self.SetStatusText(to_locale(unicode(e))) group_tree = [] else: self.SetStatusText(to_locale(self.client.status))
self.SetStatusText(to_locale(unicode(e)))
self.SetStatusText(to_wx(unicode(e)))
def DoRollCall(self, event=None): """Open the roll call dialog.
self.SetStatusText(to_locale(self.client.status))
self.SetStatusText(to_wx(self.client.status))
def DoRollCall(self, event=None): """Open the roll call dialog.
% to_locale(member.person_title))
% to_wx(member.person_title))
def DoViewPersonAbsences(self, event=None): """Open the absences window for the currently selected person.
% to_locale(member.person_title),
% to_wx(member.person_title),
def DoViewPersonTimetables(self, event=None): """Open the timetables window for the currently selected person.
% to_locale(member.person_title),
% to_wx(member.person_title),
def DoViewPersonCompositeTimetables(self, event=None): """Open the composite timetables window for the currently selected person.
[to_locale("%s, %s" % c) for c in choices])
[to_wx("%s, %s" % c) for c in choices])
def DoViewSchoolTimetable(self, event=None): """Open a school timetable window for a selected timetable.
"""Parses HTTP Accept: header.
"""Parse HTTP Accept: header.
def parseAccept(value): """Parses HTTP Accept: header. See RFC 2616, section 14.1 for a formal grammar. Returns a list of tuples (qvalue, media_type, media_params, accept_params) qvalue is a float in range 0..1 (inclusive) media_type is a string "type/subtype", it can be "type/*" or "*/*" media_params is a dict acce...
"""Chooses the best matching media type.
"""Choose the best matching media type.
def chooseMediaType(supported_types, accept_list): """Chooses the best matching media type. supported_types should be a sequence of media types. Media type can be a string or a tuples of (media_type, params_dict). Returns the media type that has the largest quality value as calculated by qualityOf. If the largest q...
"""Resets the state of the request.
"""Reset the state of the request.
def reset(self): """Resets the state of the request.
"""Creates a site.
"""Create a site.
def __init__(self, db, rootName, viewFactory, authenticate, exception_logs=[sys.stderr]): """Creates a site.
"""Starts the SchoolTool HTTP server.
"""Start the SchoolTool HTTP server.
def main(self, args): """Starts the SchoolTool HTTP server.
"""Prints an informative message when the config file does not define a
"""Print an informative message when the config file does not define a
def noStorage(self): """Prints an informative message when the config file does not define a storage.""" print >> sys.stderr, no_storage_error_msg
"""Returns the default config file pathname.
"""Return the default config file pathname.
def findDefaultConfigFile(self): """Returns the default config file pathname.
dlg = wxDialog(None, -1, _("Application log"), style=(DEFAULT_DLG_STYLE | wxRESIZE_BORDER | wxDIALOG_MODAL))
dlg = wxDialog(self, -1, _("Application log"), style=(DEFAULT_DLG_STYLE | wxRESIZE_BORDER))
def DoViewApplicationLog(self, event=None): """Open the application log window.
dlg.ShowModal() dlg.Destroy()
dlg.Show()
def DoViewApplicationLog(self, event=None): """Open the application log window.
'data'),
None),
def doctest_SetupDataView_update(): """Tests for SetupDataView.update method >>> app = setupSchoolToolSite() >>> from schooltool.setupdata.browser import SetupDataView Now, let's set up some stub setup data plugins. >>> p1 = DummySetupPlugin("work", ()) >>> p2 = DummySetupPlugin("play", ("work", )) >>> ztapi.provide...
'data')]
None)]
def doctest_SetupDataView_update(): """Tests for SetupDataView.update method >>> app = setupSchoolToolSite() >>> from schooltool.setupdata.browser import SetupDataView Now, let's set up some stub setup data plugins. >>> p1 = DummySetupPlugin("work", ()) >>> p2 = DummySetupPlugin("play", ("work", )) >>> ztapi.provide...
if startdate < start: startdate = start weeks = weekspan(start, startdate)
if startdate >= start: weeks = weekspan(start, startdate) else: weeks = 0
def _scroll(self, event, startdate): """Fast-forward to recurrences near startdate""" start = event.dtstart.date() if startdate < start: startdate = start weeks = weekspan(start, startdate) perweek = len(self.weekdays) + 1 # nr of recurrences per week count = weeks / self.interval * perweek if count > perweek: count -=...
raise KeyError, name
raise KeyError(name)
def new(self, __name__=None, **kw): name = __name__ if name is None: name = self._newName() while name in self._contents: name = self._newName() elif name in self._contents: raise KeyError, name obj = self._factory(**kw) self._contents[name] = obj obj.__name__ = name obj.__parent__ = self return obj
raise RestError('Preference value "%s" does not pass validation on "%s"' % (value, name))
raise RestError('Preference value "%s" does not' ' pass validation on "%s"' % (value, name))
def validatePreference(self, name, value): """Validate a preference.
importer = TimetableCSVImporter(self.context, charset)
root = removeSecurityProxy(self.context) importer = TimetableCSVImporter(root, charset)
def update(self): if "UPDATE_SUBMIT" not in self.request: return
('day_ids', _("Day ids not defined in selected schema: %s.")), ('periods', _("Periods not defined in selected days: %s.")), ('persons', _("Persons not found: %s.")), ('courses', _("Courses not found: %s.")), ('sections', _("Sections not found: %s.")), ('locations', _("Locations not found: %s.")), ('records', _("Invalid...
('day_ids', _("Day ids not defined in selected schema: ${args}.")), ('periods', _("Periods not defined in selected days: ${args}.")), ('persons', _("Persons not found: ${args}.")), ('courses', _("Courses not found: ${args}.")), ('sections', _("Sections not found: ${args}.")), ('locations', _("Locations not found: ${arg...
def _presentErrors(self, err): if err.generic: self.errors.extend(err.generic)
values = ', '.join([str(st) for st in v]) self.errors.append(msg % values)
values = ', '.join([unicode(st) for st in v]) print msg, repr(values) msg.mapping = {'args': values} self.errors.append(msg)
def _presentErrors(self, err): if err.generic: self.errors.extend(err.generic)
def render(self, height=12, point_width=1, spacing=2):
def render(self, height=12, point_width=2, spacing=1):
def render(self, height=12, point_width=1, spacing=2): """Render sparkline of specified size and return as PIL image.""" data = self.getData() number_of_days = len(data) left_margin = 0 if number_of_days < self.width: left_margin = self.width - number_of_days attrs = data width = (left_margin + number_of_days) * (point...
draw.rectangle((x, middle, x+point_width, middle+real_size),
draw.rectangle((x, middle, x+point_width-1, middle+real_size),
def render(self, height=12, point_width=1, spacing=2): """Render sparkline of specified size and return as PIL image.""" data = self.getData() number_of_days = len(data) left_margin = 0 if number_of_days < self.width: left_margin = self.width - number_of_days attrs = data width = (left_margin + number_of_days) * (point...
draw.rectangle((x, middle, x+point_width, middle-real_size),
draw.rectangle((x, middle, x+point_width-1, middle-real_size),
def render(self, height=12, point_width=1, spacing=2): """Render sparkline of specified size and return as PIL image.""" data = self.getData() number_of_days = len(data) left_margin = 0 if number_of_days < self.width: left_margin = self.width - number_of_days attrs = data width = (left_margin + number_of_days) * (point...
def renderAsUriData(self, height=12, point_width=1, spacing=1):
def renderAsUriData(self, height=12, point_width=2, spacing=0):
def renderAsUriData(self, height=12, point_width=1, spacing=1): """Render sparkline as a URI using the 'data' scheme.
n = self.testsRun + 1
def startTest(self, test): if self.cfg.progress: # verbosity == 0: 'xxxx/xxxx (xxx.x%)' # verbosity == 1: 'xxxx/xxxx (xxx.x%): test name' # verbosity >= 2: 'xxxx/xxxx (xxx.x%): test name ... ok' n = self.testsRun + 1 self.stream.write("\r%4d" % n) if self.count: self.stream.write("/%d (%5.1f%%)" % (self.count, n * 100....
self.__super_startTest(test)
def startTest(self, test): if self.cfg.progress: # verbosity == 0: 'xxxx/xxxx (xxx.x%)' # verbosity == 1: 'xxxx/xxxx (xxx.x%): test name' # verbosity >= 2: 'xxxx/xxxx (xxx.x%): test name ... ok' n = self.testsRun + 1 self.stream.write("\r%4d" % n) if self.count: self.stream.write("/%d (%5.1f%%)" % (self.count, n * 100....
while remaining and remaining[0] not in ('Expected:', 'Exception raised:'):
terminators = ['Expected:', 'Expected nothing', 'Exception raised:'] while remaining and remaining[0] not in terminators:
def colorize_zope_doctest_output(lines): """Colorize output formatted by the doctest engine included with Zope 3. Returns a new sequence of colored strings. `lines` is a sequence of strings. The typical structure of the doctest output looks either like this: File "...", line 123, in foo.bar.baz.doctest_quux Failed ...
if remaining[0] == 'Expected:':
if remaining[0] in ('Expected:', 'Expected nothing'):
def colorize_zope_doctest_output(lines): """Colorize output formatted by the doctest engine included with Zope 3. Returns a new sequence of colored strings. `lines` is a sequence of strings. The typical structure of the doctest output looks either like this: File "...", line 123, in foo.bar.baz.doctest_quux Failed ...
while remaining and remaining[0] != 'Got:':
while remaining and remaining[0] not in ('Got:', 'Got nothing'):
def colorize_zope_doctest_output(lines): """Colorize output formatted by the doctest engine included with Zope 3. Returns a new sequence of colored strings. `lines` is a sequence of strings. The typical structure of the doctest output looks either like this: File "...", line 123, in foo.bar.baz.doctest_quux Failed ...
if not remaining or remaining[0] != 'Got:':
if not remaining or remaining[0] not in ('Got:', 'Got nothing'):
def colorize_zope_doctest_output(lines): """Colorize output formatted by the doctest engine included with Zope 3. Returns a new sequence of colored strings. `lines` is a sequence of strings. The typical structure of the doctest output looks either like this: File "...", line 123, in foo.bar.baz.doctest_quux Failed ...
do("bin/schooltooltest 'schooltool'")
def do(command): print command if os.system(command): sys.exit(1)
Make it possilble to pass the --paths and --default-config options to the
Make it possible to pass the --paths and --default-config options to the
def finalize_options(self): self.set_undefined_options('install', ('install_lib', 'install_dir')) return _install_data.finalize_options(self)
paths.insert(-1, 'sys.path.insert(0, %s)' \ % repr(os.path.abspath(path)))
paths.insert(-1, 'sys.path.insert(0, %s)' % repr(os.path.abspath(path)))
def update_scripts(self): for script in self.get_outputs(): # Read the installed script try: script_file = open(script, 'r') script_str = script_file.read() finally: script_file.close() # Update the paths in the script paths_regex = re.compile(r'# paths begin\n.*# paths end', re.S) paths = ['# paths begin', '# paths en...
datafile_re = re.compile('.*\.(pt|js|png|gif|css|mo|rng|xml|zcml|ico|pot|po)\Z')
datafile_re = re.compile(r'.*\.(pt|js|png|gif|css|mo|rng" "|xml|zcml|ico|pot|po)\Z')
def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs)
tmp = [os.path.join(root, file) for file in files \ if datafile_re.match(file, 1)]
tmp = [os.path.join(root, file) for file in files if datafile_re.match(file, 1)]
def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs)
self._db._closeConnection(self)
db = self._db
def close(self): """Close the Connection.
def test(self): from schooltool.debug import EventLog, IEventLog from schooltool.interfaces import IEventTarget event_log = EventLog() verifyObject(IEventTarget, event_log) verifyObject(IEventLog, event_log) event1, event2 = object(), object() event_log.notify(event1) event_log.notify(event2) self.assertEquals(event_lo...
implements(IEventLog)
def test(self): from schooltool.debug import EventLog, IEventLog from schooltool.interfaces import IEventTarget event_log = EventLog() verifyObject(IEventTarget, event_log) verifyObject(IEventLog, event_log) event1, event2 = object(), object() event_log.notify(event1) event_log.notify(event2) self.assertEquals(event_lo...
event_log.clear() self.assertEquals(event_log.received, [])
def __init__(self): GroupMember.__init__(self) self.received = PersistentList() def notify(self, event): self.received.append(event) def clear(self): del self.received[:]
def test(self): from schooltool.debug import EventLog, IEventLog from schooltool.interfaces import IEventTarget event_log = EventLog() verifyObject(IEventTarget, event_log) verifyObject(IEventLog, event_log) event1, event2 = object(), object() event_log.notify(event1) event_log.notify(event2) self.assertEquals(event_lo...
class TestEventLogger(unittest.TestCase):
class EventLogger(GroupMember):
def test(self): from schooltool.debug import EventLog, IEventLog from schooltool.interfaces import IEventTarget event_log = EventLog() verifyObject(IEventTarget, event_log) verifyObject(IEventLog, event_log) event1, event2 = object(), object() event_log.notify(event1) event_log.notify(event2) self.assertEquals(event_lo...
def setUp(self):
implements(IEventTarget)
def setUp(self):
class LogHandler(logging.Handler): def __init__(self): logging.Handler.__init__(self) self.emitted = []
def notify(self, event): logging.debug('Event: %r' % event)
def setUp(self):
def emit(self, record): self.emitted.append(self.format(record)) self.log_handler = LogHandler() self.old_handlers = logging.root.handlers logging.root.handlers = [] logging.root.addHandler(self.log_handler) self.old_level = logging.root.level logging.root.setLevel(logging.DEBUG) def tearDown(self): logging.root.remo...
def emit(self, record): self.emitted.append(self.format(record))
raise NotImplementedError()
raise NotImplementedError("Please override this method in subclasses")
def createAndAdd(self, obj, dry_run=True): """Create object and add to container.
This class just holds errors that occour in the CSVImporter class so they can be delt with by the CSVImportView class.
This class just holds errors that occur in the CSVImporter class so they can be dealt with by the CSVImportView class.
def createAndAdd(self, obj, dry_run=True): """Create object and add to container.
return translate(_("Explanation was accepted."))
return translate(_("Explanation was accepted.", mapping=workaround))
def incidentDescription(self, record): """The description of the event for the attendance record.""" if record.isExplained(): return translate(_("Explanation was accepted.")) else: return translate(_("Is not explanained yet."))
return translate(_("Is not explanained yet."))
return translate(_("Is not explanained yet.", mapping=workaround))
def incidentDescription(self, record): """The description of the event for the attendance record.""" if record.isExplained(): return translate(_("Explanation was accepted.")) else: return translate(_("Is not explanained yet."))
title = TextLine(title=u"Full name", description=u"Name that should be displayed") photo = Bytes(title=u"Photo",
title = TextLine( title=_("Full name"), description=_("Name that should be displayed")) photo = Bytes( title=_("Photo"),
def clear(): """Remove all notes."""
description=u"""Photo (in JPEG format)""") username = TextLine(title=u"Username")
description=_("""Photo (in JPEG format)""")) username = TextLine( title=_("Username"))
def clear(): """Remove all notes."""
title = TextLine(title=u"Title", description=u"Title of the group.") description = Text(title=u"Description",
title = TextLine( title=_("Title"), description=_("Title of the group.")) description = Text( title=_("Description"),
def setPassword(password): """Set the password in a hashed form, so it can be verified later.
description=u"Description of the group.")
description=_("Description of the group."))
def setPassword(password): """Set the password in a hashed form, so it can be verified later.
title = TextLine(title=u"Title", description=u"Title of the resource.") description = Text(title=u"Description",
title = TextLine( title=_("Title"), description=_("Title of the resource.")) description = Text( title=_("Description"),
def setPassword(password): """Set the password in a hashed form, so it can be verified later.
description=u"Description of the resource.")
description=_("Description of the resource."))
def setPassword(password): """Set the password in a hashed form, so it can be verified later.
config = [' 'sys.argv.insert(1, \'--config=%s.conf\' % __file__)', '
config = [" "sys.argv.insert(1, '--config=%s.conf' % __file__)", "
def update_scripts(self): for script in self.get_outputs(): # Read the installed script try: script_file = open(script, 'r') script_str = script_file.read() finally: script_file.close() # Update the paths in the script paths_regex = re.compile(r'# paths begin\n.*# paths end', re.S) paths = ['# paths begin', '# paths en...
config[1] = 'sys.argv.insert(1, \'--config=%s\')'\ % os.path.abspath(self.default_config)
config[1] = ("sys.argv.insert(1, '--config=%s')" % os.path.abspath(self.default_config))
def update_scripts(self): for script in self.get_outputs(): # Read the installed script try: script_file = open(script, 'r') script_str = script_file.read() finally: script_file.close() # Update the paths in the script paths_regex = re.compile(r'# paths begin\n.*# paths end', re.S) paths = ['# paths begin', '# paths en...
datafile_re = re.compile('.*\.(pt|js|png|gif|css|mo|rng|xml|zcml|pot|po)\Z')
datafile_re = re.compile(r'.*\.(pt|js|png|gif|css|mo|rng|xml|zcml|pot|po)\Z')
def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs)
There are several clients that demonstrate the usage of the REST interface (a command-line client that is used for functional tests, a wxWidgets GUI client, and a command-line client for data import).
def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs)
self.page_ctrl.SetValue(self.page)
self.page_ctrl.SetValue(str(self.page))
def OnGotoPage(self, event=None): """Jump to the page entered in the page control.""" try: self.page = int(self.page_ctrl.GetValue()) except ValueError: # Restore the original page number if the user-specified one # is not valid. self.page_ctrl.SetValue(self.page) else: self.refresh()
"""
We need a __parent__ attribute for local security grants: >>> stt.__parent__ is calendar True """
def getApplicationPreferences(app): """Adapt a SchoolToolApplication to IApplicationPreferences.""" annotations = IAnnotations(app) key = 'schooltool.app.ApplicationPreferences' try: return annotations[key] except KeyError: annotations[key] = ApplicationPreferences() annotations[key].__parent__ = app return annotation...
queryMultiAdapter = queryMultiAdapter
queryMultiAdapter = staticmethod(queryMultiAdapter)
def browserDefault(self, request): return self.context, ('index.html', )
title = TextLine(title=u"Full name", description=u"Name that should be displayed") photo = Bytes(title=u"New photo", required=False, description=u"""Photo (in JPEG format)""") clear_photo = Bool(title=u'Clear photo', required=False, description=u"""Check this to clear the photo""") new_password = Password(title=u"Ne...
title = TextLine( title=_("Full name"), description=_("Name that should be displayed")) photo = Bytes( title=_("New photo"), required=False, description=_("""Photo (in JPEG format)""")) clear_photo = Bool( title=_("Clear photo"), required=False, description=_("""Check this to clear the photo""")) new_password = Pass...
def update(self): # This method is rather similar to GroupListView.update(). context_url = zapi.absoluteURL(self.context, self.request) if 'UPDATE_SUBMIT' in self.request: context_members = removeSecurityProxy(self.context.members) for member in self.getPotentialMembers(): want = bool('member.' + member.__name__ in sel...
timezone = Choice(title=u"Time Zone", description=u"Time Zone used to display your calendar", values=common_timezones) timeformat = Choice(title=u"Time Format", description=u"Time Format", values=("HH:MM", "H:MM am/pm")) dateformat = Choice(title=u"Date Format", description=u"Date Format", values=("MM/DD/YY", "YYYY-D...
timezone = Choice( title=_("Time Zone"), description=_("Time Zone used to display your calendar"), values=common_timezones) timeformat = Choice( title=_("Time Format"), description=_("Time Format"), values=("HH:MM", "H:MM am/pm")) dateformat = Choice( title=_("Date Format"), description=_("Date Format"), values=("MM/...
def update(self): if 'UPDATE_SUBMIT' in self.request: try: data = getWidgetsData(self, IPersonEditForm) except WidgetsError: return # Errors will be displayed next to widgets
title = TextLine(title=u"Full name", description=u"Name that should be displayed") username = TextLine(title=u"Username", description=u"Username") password = Password(title=u"Password",
title = TextLine( title=_("Full name"), description=_("Name that should be displayed")) username = TextLine( title=_("Username"), description=_("Username")) password = Password( title=_("Password"),
def update(self): if 'CANCEL' in self.request: url = zapi.absoluteURL(self.context, self.request) self.request.response.redirect(url)
verify_password = Password(title=u"Verify password",
verify_password = Password( title=_("Verify password"),
def update(self): if 'CANCEL' in self.request: url = zapi.absoluteURL(self.context, self.request) self.request.response.redirect(url)
photo = Bytes(title=u"Photo",
photo = Bytes( title=_("Photo"),
def update(self): if 'CANCEL' in self.request: url = zapi.absoluteURL(self.context, self.request) self.request.response.redirect(url)
description=u"""Photo (in JPEG format)""")
description=_("""Photo (in JPEG format)"""))
def update(self): if 'CANCEL' in self.request: url = zapi.absoluteURL(self.context, self.request) self.request.response.redirect(url)
self.error = u'Passwords do not match!' raise WidgetsError([ValidationError('Passwords do not match!')])
self.error = _("Passwords do not match!") raise WidgetsError([ValidationError(self.error)])
def createAndAdd(self, data): """Create a Person from form data and add it to the container.""" if data['password'] != data['verify_password']: self.error = u'Passwords do not match!' raise WidgetsError([ValidationError('Passwords do not match!')]) elif data['username'] in self.context: self.error = u'This username is ...
self.error = u'This username is already used!' raise WidgetsError( [ValidationError('This username is already used!')])
self.error = _('This username is already used!') raise WidgetsError([ValidationError(self.error)])
def createAndAdd(self, data): """Create a Person from form data and add it to the container.""" if data['password'] != data['verify_password']: self.error = u'Passwords do not match!' raise WidgetsError([ValidationError('Passwords do not match!')]) elif data['username'] in self.context: self.error = u'This username is ...
result.append({'title': 'Authenticated users', 'id': all.id,
result.append({'title': _('Authenticated users'), 'id': all.id,
def getGroups(self): app = getSchoolBellApplication() auth = zapi.getUtility(IAuthentication) map = IPrincipalPermissionManager(self.context) result = [] all = zapi.queryUtility(IAuthenticatedGroup) if all is not None: result.append({'title': 'Authenticated users', 'id': all.id, 'perms': self.permsForPrincipal(all.id)}...
result.append({'title': 'Unauthenticated users', 'id': unauth.id,
result.append({'title': _('Unauthenticated users'), 'id': unauth.id,
def getGroups(self): app = getSchoolBellApplication() auth = zapi.getUtility(IAuthentication) map = IPrincipalPermissionManager(self.context) result = [] all = zapi.queryUtility(IAuthenticatedGroup) if all is not None: result.append({'title': 'Authenticated users', 'id': all.id, 'perms': self.permsForPrincipal(all.id)}...
personids = [prin['id'] for prin in self.getPersons()] groupids = [prin['id'] for prin in self.getGroups()]
personids = [principal['id'] for principal in self.getPersons()] groupids = [principal['id'] for principal in self.getGroups()]
def getPrincipals(self): personids = [prin['id'] for prin in self.getPersons()] groupids = [prin['id'] for prin in self.getGroups()] return groupids + personids
self._order.remove(key)
def __delitem__(self, key): """See interface `IWriteContainer`""" zope.app.container.contained.uncontained(self._data[key], self, key) self._order.remove(key) del self._data[key]
<input type="checkbox" checked="checked" disabled="disabled" /> <input type="checkbox" name="my_timetable" checked="checked" /> My Calendar ... <input type="checkbox" name="overlay:list" checked="checked" value="/groups/g1" /> <input type="checkbox" name="overlay_timetables:list" value="/groups/g1" /> ... <input type="...
...<input type="checkbox" checked="checked" disabled="disabled" />... ...<input type="checkbox" name="my_timetable" checked="checked" />... ...My Calendar... ... ...<input type="checkbox" name="overlay:list" checked="checked" value="/groups/g1" />... ...<input type="checkbox" name="overlay_timetables:list" value="/grou...
def doctest_CalendarSTOverlayView(): r"""Tests for CalendarSTOverlayView >>> from schooltool.browser.cal import CalendarSTOverlayView >>> View = SimpleViewClass('../templates/calendar_overlay.pt', ... bases=(CalendarSTOverlayView,)) CalendarOverlayView is a view on anything. >>> context = obje...
<input type="checkbox" checked="checked" disabled="disabled" /> <input type="checkbox" name="my_timetable" /> My Calendar ... <input type="checkbox" name="overlay:list" value="/groups/g1" /> <input type="checkbox" name="overlay_timetables:list" checked="checked" value="/groups/g1" /> ... <input type="checkbox" name="ov...
...<input type="checkbox" checked="checked" disabled="disabled" />... ...<input type="checkbox" name="my_timetable" />... ...My Calendar... ... ...<input type="checkbox" name="overlay:list" value="/groups/g1" />... ...<input type="checkbox" name="overlay_timetables:list" checked="checked" value="/groups/g1" />... ... ....
def doctest_CalendarSTOverlayView(): r"""Tests for CalendarSTOverlayView >>> from schooltool.browser.cal import CalendarSTOverlayView >>> View = SimpleViewClass('../templates/calendar_overlay.pt', ... bases=(CalendarSTOverlayView,)) CalendarOverlayView is a view on anything. >>> context = obje...
self.stream.write(" (errors=%s" % c('count', str(errored)))
else: self.stream.write("(") self.stream.write("errors=%s" % c('count', str(errored)))
def run(self, test): """Run the given test case or test suite.""" if self.count is None: self.count = test.countTestCases() if self.cfg.colorize: c = colorize else: c = lambda texttype, text: text result = self._makeResult() startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startT...
Warning: font directory '...test_main.py' does not exist.
Warning: font directory '...test_main...' does not exist.
>>> def setupStub(fontdir):
def __init__(self, parent, group_title, rollcall): wxDialog.__init__(self, parent, -1, "Roll Call for %s" % group_title,
def __init__(self, parent, group_title, group_href, rollcall, client): title = "Roll Call for %s" % group_title wxDialog.__init__(self, parent, -1,title,
def __init__(self, parent, group_title, rollcall): wxDialog.__init__(self, parent, -1, "Roll Call for %s" % group_title, style=wxDIALOG_MODAL|wxCAPTION|wxRESIZE_BORDER|wxTHICK_FRAME)
self.EndModal(wxID_OK)
rollcall = self.getRollCall() try: self.client.submitRollCall(self.group_href, rollcall) except SchoolToolError, e: wxMessageBox("Could not submit the roll call: %s" % e, self.title, wxICON_ERROR|wxOK) else: self.EndModal(wxID_OK)
def OnOk(self, event): """Verify that all required data is entered before closing the dialog. """ for (href, was_absent, absent, present, comment, resolve, dontresolve) in self.items: if absent.GetValue() == present.GetValue(): present.SetFocus() wxBell() return if (present.GetValue() and was_absent and resolve.GetValu...
dlg = RollCallDlg(self, group_title, rollcall)
dlg = RollCallDlg(self, group_title, group_href, rollcall, self.client)
def DoRollCall(self, event=None): """Open the roll call dialog.