bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def index_backgrounds(request): #if request.path.strip() == '': return {'backgrounds': ["/media/images/home/pagebkg1.jpg", "/media/images/home/pagebkg2.jpg", "/media/images/home/pagebkg3.jpg"]} return {}
def index_backgrounds(request): #if request.path.strip() == '': return {'backgrounds': [settings.MEDIA_URL+"images/home/pagebkg1.jpg", settings.MEDIA_URL+"images/home/pagebkg2.jpg", settings.MEDIA_URL+"images/home/pagebkg3.jpg"]} return {}
453,600
def get_student_schedules(request, students, prog, extra='', onsite=False): """ generate student schedules """
def get_student_schedules(request, students, prog, extra='', onsite=False): """ generate student schedules """
453,601
def get_student_schedules(request, students, prog, extra='', onsite=False): """ generate student schedules """
def basedir = 'program/modules/programprintables/' get_student_schedules(request, basedir = 'program/modules/programprintables/' students, basedir = 'program/modules/programprintables/' prog, basedir = 'program/modules/programprintables/' extra='', basedir = 'program/modules/programprintables/' onsite=False): basedir =...
453,602
def get_student_schedules(request, students, prog, extra='', onsite=False): """ generate student schedules """
def get_student_schedules(request, students, prog, extra='', onsite=False): """ generate student schedules """
453,603
def get_student_schedules(request, students, prog, extra='', onsite=False): """ generate student schedules """
def get_student_schedules(request, students, prog, extra='', onsite=False): """ generate student schedules """
453,604
def drop_empty_answers(lst): # Takes a list of answers and drops empty ones. Whitespace-only is empty. return [ ans for ans in lst if (not isinstance(ans.answer, basestring)) or ans.answer.strip() ]
def drop_empty_answers(lst): # Takes a list of answers and drops empty ones. Whitespace-only is empty. return [ ans for ans in lst if (not isinstance(ans.answer, basestring)) or ans.answer.strip() ]
453,605
def list_classes(ans): # If the answer is a list of classes, render a shiny list of their titles. # If the answer is an ordinary list, prettify the list. # Otherwise just spit the answer back out. # Kind of inelegant, but I didn't want to make yet another set of templates. if not isinstance(ans, list): return ans newli...
def list_classes(ans): # If the answer is a list of classes, render a shiny list of their titles. # If the answer is an ordinary list, prettify the list. # Otherwise just spit the answer back out. # Kind of inelegant, but I didn't want to make yet another set of templates. if not isinstance(ans, list): return ans newli...
453,606
def user_registration(request): """ Registration view -- takes care of users who want to create a new account. """ if request.user.is_authenticated(): return render_to_response('registration/already_logged_in.html', request, request.get_node('Q/Web/myesp'), {}) if request.method == 'POST': form = UserRegForm(request....
def user_registration(request): """ Registration view -- takes care of users who want to create a new account. """ if request.user.is_authenticated(): return render_to_response('registration/already_logged_in.html', request, request.get_node('Q/Web/myesp'), {}) if request.method == 'POST': form = UserRegForm(request....
453,607
def hide_choice_if_useless(field): """ Hide a choice field if there's only one choice """ if len(field.choices) == 1: hide_field(field, default=field.choices[0][0])
def hide_choice_if_useless(field): """ Hide a choice field if there's only one choice """ if len(field.choices) == 1: hide_field(field, default=field.choices[0][0])
453,608
def catalog(self, program, ts=None, force_all=False, initial_queryset=None): # Try getting the catalog straight from cache print (program, ts, force_all, initial_queryset, True) catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None: # Get it from the DB, then try pr...
def catalog(self, program, ts=None, force_all=False, initial_queryset=None, use_cache=True, cache_only=False): # Try getting the catalog straight from cache print (program, ts, force_all, initial_queryset, True) catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None:...
453,609
def catalog(self, program, ts=None, force_all=False, initial_queryset=None): # Try getting the catalog straight from cache print (program, ts, force_all, initial_queryset, True) catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None: # Get it from the DB, then try pr...
def catalog(self, program, ts=None, force_all=False, initial_queryset=None): # Try getting the catalog straight from cache catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None: # Get it from the DB, then try prefetching class sizes catalog = self.catalog_cached(pro...
453,610
def catalog(self, program, ts=None, force_all=False, initial_queryset=None): # Try getting the catalog straight from cache print (program, ts, force_all, initial_queryset, True) catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None: # Get it from the DB, then try pr...
def catalog(self, program, ts=None, force_all=False, initial_queryset=None): # Try getting the catalog straight from cache print (program, ts, force_all, initial_queryset, True) catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None: # Get it from the DB, then try pr...
453,611
def force_availability(self, request, tl, one, two, module, extra, prog): teacher_dict = prog.teachers() if request.method == 'POST': if request.POST.has_key('sure') and request.POST['sure'] == 'True': # Find all teachers who have not indicated their availability and do it for them. unavailable_teachers = User.obje...
def force_availability(self, request, tl, one, two, module, extra, prog): teacher_dict = prog.teachers() if request.method == 'POST': if request.POST.has_key('sure') and request.POST['sure'] == 'True': # Find all teachers who have not indicated their availability and do it for them. unavailable_teachers = User.obje...
453,612
def findModuleObject(tl, call_txt, prog): modules = ProgramModule.objects.filter(main_call = call_txt, module_type = tl).select_related()[:1]
def findModuleObject(tl, call_txt, prog): modules = ProgramModule.objects.filter(main_call = call_txt, module_type = tl).select_related()[:1]
453,613
def findModuleObject(tl, call_txt, prog): modules = ProgramModule.objects.filter(main_call = call_txt, module_type = tl).select_related()[:1]
def findModuleObject(tl, call_txt, prog): modules = ProgramModule.objects.filter(main_call = call_txt, module_type = tl).select_related()[:1]
453,614
def findModule(request, tl, one, two, call_txt, extra, prog): moduleobj = ProgramModuleObj.findModuleObject(tl, call_txt, prog) user = ESPUser(request.user) # If a "core" module has been found: # Put the user through a sequence of all required modules in the same category. if tl != "manage" and request.user.is_aut...
def findModule(request, tl, one, two, call_txt, extra, prog): moduleobj = ProgramModuleObj.findModuleObject(tl, call_txt, prog) user = ESPUser(request.user) # If a "core" module has been found: # Put the user through a sequence of all required modules in the same category. if tl != "manage" and request.user.is_aut...
453,615
def drop_empty_answers(lst): # Takes a list of answers and drops empty ones. Whitespace-only is empty. return [ ans for ans in lst if (not isinstance(ans.answer, basestring)) or ans.answer.strip() ]
def drop_empty_answers(lst): # Takes a list of answers and drops empty ones. Whitespace-only is empty. return [ ans for ans in lst if (not isinstance(ans.answer, basestring)) or ans.answer.strip() ]
453,616
def list_classes(ans): # If the answer is a list of classes, render a shiny list of their titles. # If the answer is an ordinary list, prettify the list. # Otherwise just spit the answer back out. # Kind of inelegant, but I didn't want to make yet another set of templates. if not isinstance(ans, list): return ans newli...
def list_classes(ans): # If the answer is a list of classes, render a shiny list of their titles. # If the answer is an ordinary list, prettify the list. # Otherwise just spit the answer back out. # Kind of inelegant, but I didn't want to make yet another set of templates. if not isinstance(ans, list): return ans newli...
453,617
def process_response(self, request, response):
def process_response(self, request, response):
453,618
def preregister_student(self, user, overridefull=False, priority=1, prereg_verb = None, fast_force_create=False): StudentRegistration, RegistrationType = self.StudentRegistration, self.RegistrationType
def preregister_student(self, user, overridefull=False, priority=1, prereg_verb = None, fast_force_create=False): StudentRegistration, RegistrationType = self.StudentRegistration, self.RegistrationType
453,619
def preregister_student(self, user, overridefull=False, priority=1, prereg_verb = None, fast_force_create=False): StudentRegistration, RegistrationType = self.StudentRegistration, self.RegistrationType
def preregister_student(self, user, overridefull=False, priority=1, prereg_verb = None, fast_force_create=False): StudentRegistration, RegistrationType = self.StudentRegistration, self.RegistrationType
453,620
def findCategoryModules(self, include_optional): prog = self.program module_type = self.module.module_type
def findCategoryModules(self, include_optional): prog = self.program module_type = self.module.module_type
453,621
def findModule(request, tl, one, two, call_txt, extra, prog): moduleobj = ProgramModuleObj.findModuleObject(tl, call_txt, prog) user = ESPUser(request.user) # If a "core" module has been found: # Put the user through a sequence of all required modules in the same category. #if tl != "manage" and request.user.is_au...
def findModule(request, tl, one, two, call_txt, extra, prog): moduleobj = ProgramModuleObj.findModuleObject(tl, call_txt, prog) user = ESPUser(request.user) # If a "core" module has been found: # Put the user through a sequence of all required modules in the same category. #if tl != "manage" and request.user.is_au...
453,622
def deadline_met(self, extension=''): if self.user.isAdmin(self.program): return True if len(extension) > 0: return super(TeacherClassRegModule, self).deadline_met(extension)
def deadline_met(self, extension=''): if self.user.isAdmin(self.program): return True if len(extension) > 0: return super(TeacherClassRegModule, self).deadline_met(extension)
453,623
def getFirstClassTime(self, program): sections = self.getEnrolledSectionsFromProgram(program).order_by('meeting_times') if sections.count() == 0: return None else: if sections[0].meeting_times.count() == 0: return None else: return sections[0].meeting_times.order_by('start')[0]
def getFirstClassTime(self, program): sections = self.getSections(program, verbs=['Enrolled']).order_by('meeting_times') if sections.count() == 0: return None else: if sections[0].meeting_times.count() == 0: return None else: return sections[0].meeting_times.order_by('start')[0]
453,624
def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row): "Helper function for outputting HTML. Used by as_table(), as_ul(), as_p()." top_errors = self.non_field_errors() # Errors that should be displayed above all fields. output, hidden_fields = [], [] first = True for name, fie...
def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row): "Helper function for outputting HTML. Used by as_table(), as_ul(), as_p()." top_errors = self.non_field_errors() # Errors that should be displayed above all fields. output, hidden_fields = [], [] first = True for name, fie...
453,625
def hide_field(field, default=None): field.widget = forms.HiddenInput() if default is not None: field.initial = default
def hide_field(field, default=None): field.widget = forms.HiddenInput() if default is not None: field.initial = default
453,626
def getTaughtClassesFromProgram(self, program): from esp.program.models import ClassSubject, Program # Need the Class object. # Why is it that we had a find_by_anchor_perms function again? tr_node = GetNode('V/Flags/Registration/Teacher') all_classes = ClassSubject.objects.filter(anchor__userbit_qsc__verb__id=tr_nod...
def getTaughtClassesFromProgram(self, program): from esp.program.models import ClassSubject, Program # Need the Class object. # Why is it that we had a find_by_anchor_perms function again? tr_node = GetNode('V/Flags/Registration/Teacher') all_classes = ClassSubject.objects.filter(anchor__userbit_qsc__verb__id=tr_nod...
453,627
def getTaughtClassesAll(self): from esp.program.models import ClassSubject # Need the Class object. # Why is it that we had a find_by_anchor_perms function again? tr_node = GetNode('V/Flags/Registration/Teacher') return ClassSubject.objects.filter(anchor__userbit_qsc__verb__id=tr_node.id, anchor__userbit_qsc__user=s...
def getTaughtClassesAll(self): from esp.program.models import ClassSubject # Need the Class object. # Why is it that we had a find_by_anchor_perms function again? tr_node = GetNode('V/Flags/Registration/Teacher') return ClassSubject.objects.filter(anchor__userbit_qsc__verb__id=tr_node.id, anchor__userbit_qsc__user=s...
453,628
def set_class_data(self, cls, reg_form): for k, v in reg_form.cleaned_data.items(): if k not in ('category', 'resources', 'viable_times', 'optimal_class_size_range', 'allowable_class_size_ranges') and k[:8] is not 'section_': cls.__dict__[k] = v
def set_class_data(self, cls, reg_form): for k, v in reg_form.cleaned_data.items(): if k not in ('category', 'resources', 'viable_times', 'optimal_class_size_range', 'allowable_class_size_ranges') and k[:8] is not 'section_': cls.__dict__[k] = v
453,629
def set_class_data(self, cls, reg_form): for k, v in reg_form.cleaned_data.items(): if k not in ('category', 'resources', 'viable_times', 'optimal_class_size_range', 'allowable_class_size_ranges') and k[:8] is not 'section_': cls.__dict__[k] = v
def set_class_data(self, cls, reg_form): for k, v in reg_form.cleaned_data.items(): if k not in ('category', 'resources', 'viable_times', 'optimal_class_size_range', 'allowable_class_size_ranges') and k[:8] is not 'section_': cls.__dict__[k] = v
453,630
def getSchedule(program, student): schedule = """
def getSchedule(program, student): schedule = """
453,631
def students(self, QObject = False): from django.db.models import Q verb_base = DataTree.get_by_uri('V/Flags/Registration')
def students(self, QObject = False): from django.db.models import Q verb_base = DataTree.get_by_uri('V/Flags/Registration')
453,632
def runTest(self): response = self.client.get('/l' + 'o'*256 + 'ngurl.html') self.failUnless(response.status_code != 500, 'Ridiculous URL not handled gracefully.')
def runTest(self): response = self.client.get('/l' + 'o'*256 + 'ngurl.html') self.failUnless(response.status_code != 500, 'Ridiculous URL not handled gracefully.')
453,633
def setUp(self): """ Create and configure a MultihostCacheClass instance to test. Also, our last two servers are actually joined; update accordingly. """ super(MultihostCacheClassTest, self).setUp()
def setUp(self): """ Test cases for the memcached_multihost CacheClass class """ super(MultihostCacheClassTest, self).setUp()
453,634
def setUp(self): """ Create and configure a MultihostCacheClass instance to test. Also, our last two servers are actually joined; update accordingly. """ super(MultihostCacheClassTest, self).setUp()
def setUp(self): """ Create and configure a MultihostCacheClass instance to test. Also, our last two servers are actually joined; update accordingly. """ super(MultihostCacheClassTest, self).setUp()
453,635
def get_hi(self): return "hi!"
defget_hi(self):return"hi!"
453,636
def bio_edit_user_program(request, founduser, foundprogram, external=False): """ Edits a teacher bio, given user and program """ if founduser is None: if external: raise ESPError(), 'No user given.' else: raise Http404 if not founduser.isTeacher(): raise ESPError(False), '%s is not a teacher of ESP.' % \ (founduser.n...
def bio_edit_user_program(request, founduser, foundprogram, external=False): """ Edits a teacher bio, given user and program """ if founduser is None: if external: raise ESPError(), 'No user given.' else: raise Http404 if not founduser.isTeacher(): raise ESPError(False), '%s is not a teacher of ESP.' % \ (founduser.n...
453,637
def __init__(self, user=None, *args, **kwargs): super(StudentInfoForm, self).__init__(user, *args, **kwargs)
def __init__(self, user=None, *args, **kwargs): super(StudentInfoForm, self).__init__(user, *args, **kwargs)
453,638
def clean(self): cleaned_data = self.cleaned_data user = self._user
def clean(self): cleaned_data = self.cleaned_data user = self._user
453,639
def clean(self): cleaned_data = self.cleaned_data user = self._user
def clean(self): cleaned_data = self.cleaned_data user = self._user
453,640
def clean(self): cleaned_data = self.cleaned_data user = self._user
def clean(self): cleaned_data = self.cleaned_data user = self._user
453,641
def get_field_by_name(name): for f in self._meta.fields: if f.name == name: return f return None
def get_field_by_name(name): for f in self._meta.fields: if f.name == name: return f return None
453,642
def ajax_sections_cached(self, prog): sections = prog.sections().select_related('category', 'parent_class')
def ajax_sections_cached(self, prog): sections = prog.sections().select_related('category', 'parent_class')
453,643
def ajax_teachers_cached(self, prog): teachers = ESPUser.objects.filter(userbit__verb=GetNode('V/Flags/Registration/Teacher')).filter(userbit__qsc__classsubject__isnull=False, userbit__qsc__parent__parent__program=prog).distinct()
def ajax_teachers_cached(self, prog): teachers = ESPUser.objects.filter(userbit__verb=GetNode('V/Flags/Registration/Teacher')).filter(userbit__qsc__classsubject__isnull=False, userbit__qsc__parent__parent__program=prog).distinct()
453,644
def increment_global_resource_rev(): import random val = random.randint(1,2**30) cache.set(GLOBAL_RESOURCE_CACHE_KEY, val, timeout=86400) return val
def increment_global_resource_rev(): import random val = random.randint(1,2**30) cache.set(GLOBAL_RESOURCE_CACHE_KEY, val, timeout=86400) return val
453,645
def unmake_key(self, key): return key[len(settings.CACHE_PREFIX):]
def def _failfast_test(self, key, value): if FAILFAST: data_size = len(pickle.dumps(value)) if data_size > CACHE_SIZE: assert False, "Data size for key '%s' too large: %d bytes" % (key, data_size) elif data_size > CACHE_WARNING_SIZE: print "Data size for key '%s' is dangerously large: %d bytes" % (key, data_size) unma...
453,646
def __init__(self, field_name='', field=None, key_type=None, to_field=None, to_field_name=None, required=True, label='', initial=None, widget=None, help_text='', ajax_func=None, queryset=None, error_messages=None, show_hidden_initial=False, *args, **kwargs):
def __init__(self, field_name='', field=None, key_type=None, to_field=None, to_field_name=None, required=True, label='', localize=False, initial=None, widget=None, help_text='', ajax_func=None, queryset=None, error_messages=None, show_hidden_initial=False, *args, **kwargs):
453,647
def makeaclass(self, request, tl, one, two, module, extra, prog, newclass = None): self.makeaclass_logic(request, tl, one, two, module, extra, prog, newclass = None)
def makeaclass(self, request, tl, one, two, module, extra, prog, newclass = None): self.makeaclass_logic(request, tl, one, two, module, extra, prog, newclass = None)
453,648
def catalog_json(self, request, tl, one, two, module, extra, prog, timeslot=None): """ Return the program class catalog """ # using .extra() to select all the category text simultaneously classes = ClassSubject.objects.catalog(self.program)
def catalog_json(self, request, tl, one, two, module, extra, prog, timeslot=None): """ Return the program class catalog """ # using .extra() to select all the category text simultaneously classes = ClassSubject.objects.catalog(self.program)
453,649
def catalog(self, program, ts=None, force_all=False, initial_queryset=None, use_cache=True, cache_only=False): # Try getting the catalog straight from cache catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None: # Get it from the DB, then try prefetching class sizes...
def catalog(self, program, ts=None, force_all=False, initial_queryset=None, use_cache=True, cache_only=False): # Try getting the catalog straight from cache catalog = self.catalog_cached(program, ts, force_all, initial_queryset, cache_only=True) if catalog is None: # Get it from the DB, then try prefetching class sizes...
453,650
def load_data(self, cls, prefix=''): self.initial = {prefix+'status': cls.status, prefix+'reg_status': None, prefix+'min_grade': cls.grade_min, prefix+'max_grade': cls.grade_max, prefix+'notes': cls.directors_notes, prefix+'class_size': cls.class_size_max, prefix+'clsid': cls.id, prefix+'progress': [cm.id for cm in cls...
def load_data(self, cls, prefix=''): if type(cls.class_size_max) == int: csm = cls.class_size_max else: csm = 0 self.initial = { prefix+'status': cls.status, prefix+'reg_status': None, prefix+'min_grade': cls.grade_min, prefix+'max_grade': cls.grade_max, prefix+'notes': cls.directors_notes, prefix+'class_size': cls.cl...
453,651
def load_data(self, cls, prefix=''): self.initial = {prefix+'status': cls.status, prefix+'reg_status': None, prefix+'min_grade': cls.grade_min, prefix+'max_grade': cls.grade_max, prefix+'notes': cls.directors_notes, prefix+'class_size': cls.class_size_max, prefix+'clsid': cls.id, prefix+'progress': [cm.id for cm in cls...
def load_data(self, cls, prefix=''): self.initial = {prefix+'status': cls.status, prefix+'reg_status': None, prefix+'min_grade': cls.grade_min, prefix+'max_grade': cls.grade_max, prefix+'notes': cls.directors_notes, prefix+'class_size': csm , prefix+'clsid': cls.id, prefix+'progress': [cm.id for cm in cls.checklist_pro...
453,652
def _get_capacity(self, ignore_changes=False): ans = None if self.max_class_capacity is not None: ans = self.max_class_capacity else: rooms = self.initial_rooms() if len(rooms) == 0: if not ans: ans = self.parent_class.class_size_max else: ans = min(self.parent_class.class_size_max, self._get_room_capacity(rooms))
def _get_capacity(self, ignore_changes=False): ans = None if self.max_class_capacity is not None: ans = self.max_class_capacity else: rooms = self.initial_rooms() if len(rooms) == 0: if not ans: ans = self.parent_class.class_size_max else: ans = min(self.parent_class.class_size_max, self._get_room_capacity(rooms))
453,653
def profile(self, request, tl, one, two, module, extra, prog): """ Display the registration profile page, the page that contains the contact information for a student, as attached to a particular program """
def profile(self, request, tl, one, two, module, extra, prog): """ Display the registration profile page, the page that contains the contact information for a student, as attached to a particular program """
453,654
def profile(self, request, tl, one, two, module, extra, prog): """ Display the registration profile page, the page that contains the contact information for a student, as attached to a particular program """
def profile(self, request, tl, one, two, module, extra, prog): """ Display the registration profile page, the page that contains the contact information for a student, as attached to a particular program """
453,655
def process_response(self, request, response): from esp.users.models import ESPUser modified_cookies = False
def process_response(self, request, response): from esp.users.models import ESPUser modified_cookies = False
453,656
def process_response(self, request, response): from esp.users.models import ESPUser modified_cookies = False
def process_response(self, request, response): from esp.users.models import ESPUser modified_cookies = False
453,657
def make_id_tuple(object_list): return tuple([(o.id, str(o)) for o in object_list])
def make_id_tuple(object_list): return tuple([(o.id, str(o)) for o in object_list])
453,658
def make_id_tuple(object_list): return tuple([(o.id, str(o)) for o in object_list])
def make_id_tuple(object_list): return tuple([(o.id, str(o)) for o in object_list])
453,659
def force_availability(self, request, tl, one, two, module, extra, prog): teacher_dict = prog.teachers(QObjects=True) if request.method == 'POST': if request.POST.has_key('sure') and request.POST['sure'] == 'True': # Find all teachers who have not indicated their availability and do it for them. unavailable_teacher...
def force_availability(self, request, tl, one, two, module, extra, prog): teacher_dict = prog.teachers(QObjects=True) if request.method == 'POST': if request.POST.has_key('sure') and request.POST['sure'] == 'True': # Find all teachers who have not indicated their availability and do it for them. unavailable_teacher...
453,660
def execute(self): programs_to_archive = Program.objects.all()
def execute(self): programs_to_archive = Program.objects.all()
453,661
def onsite_create(self, request, tl, one, two, module, extra, prog):
def onsite_create(self, request, tl, one, two, module, extra, prog):
453,662
def onsite_create(self, request, tl, one, two, module, extra, prog):
def onsite_create(self, request, tl, one, two, module, extra, prog):
453,663
def onsite_create(self, request, tl, one, two, module, extra, prog):
def onsite_create(self, request, tl, one, two, module, extra, prog):
453,664
def onsite_create(self, request, tl, one, two, module, extra, prog):
def onsite_create(self, request, tl, one, two, module, extra, prog):
453,665
def onsite_create(self, request, tl, one, two, module, extra, prog):
def onsite_create(self, request, tl, one, two, module, extra, prog):
453,666
def executeps(self, cmd, args=None): ''' execute a command using a prepared statement. ''' # If we can't get a lock, give up and just execute the query. # No point deadlocking over this. if not connection_cache_lock.acquire(0): self._execute(cmd, args) prepStmt = self.prepCache.get(cmd) if prepStmt is None: cmdId ...
def executeps(self, cmd, args=None): ''' execute a command using a prepared statement. ''' # If we can't get a lock, give up and just execute the query. # No point deadlocking over this. if not connection_cache_lock.acquire(0): return self._execute(cmd, args) if not cmd.startswith('SELECT'): connection_cache_lock...
453,667
def executeps(self, cmd, args=None): ''' execute a command using a prepared statement. ''' # If we can't get a lock, give up and just execute the query. # No point deadlocking over this. if not connection_cache_lock.acquire(0): self._execute(cmd, args) prepStmt = self.prepCache.get(cmd) if prepStmt is None: cmdId ...
def executeps(self, cmd, args=None): ''' execute a command using a prepared statement. ''' # If we can't get a lock, give up and just execute the query. # No point deadlocking over this. if not connection_cache_lock.acquire(0): self._execute(cmd, args) prepStmt = self.prepCache.get(cmd) if prepStmt is None: cmdId ...
453,668
def classList(self, request, tl, one, two, module, extra, prog): """ Display a list of all classes that still have space in them """ context = {} defaults = {'refresh': 300, 'scrollspeed': 3} for key_option in defaults.keys(): if request.GET.has_key(key_option): context[key_option] = request.GET[key_option] else: conte...
def classList(self, request, tl, one, two, module, extra, prog): """ Display a list of all classes that still have space in them """ context = {} defaults = {'refresh': 300, 'scrollspeed': 3} for key_option in defaults.keys(): if request.GET.has_key(key_option): context[key_option] = request.GET[key_option] else: conte...
453,669
def classList(self, request, tl, one, two, module, extra, prog): """ Display a list of all classes that still have space in them """ context = {} defaults = {'refresh': 300, 'scrollspeed': 3} for key_option in defaults.keys(): if request.GET.has_key(key_option): context[key_option] = request.GET[key_option] else: conte...
def classList(self, request, tl, one, two, module, extra, prog): """ Display a list of all classes that still have space in them """ context = {} defaults = {'refresh': 300, 'scrollspeed': 3} for key_option in defaults.keys(): if request.GET.has_key(key_option): context[key_option] = request.GET[key_option] else: conte...
453,670
def load_classroom(self, program, room): self.fields['id'].initial = room.id self.fields['room_number'].initial = room.name self.fields['num_students'].initial = room.num_students self.fields['times_available'].initial = [mt.short_description for mt in room.matching_times()] self.fields['furnishings'].initial = [f.res_...
def load_classroom(self, program, room): self.fields['id'].initial = room.id self.fields['room_number'].initial = room.name self.fields['num_students'].initial = room.num_students self.fields['times_available'].initial = [mt.id for mt in room.matching_times()] self.fields['furnishings'].initial = [f.res_type.id for f i...
453,671
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
453,672
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
453,673
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
453,674
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
453,675
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
453,676
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
453,677
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
def save_classroom(self, program): """ Steps for saving a classroom: - Find the previous list of resources - Create a new list of resources - Move over resource assignments - Delete old resources """
453,678
def get_field_by_name(name): for f in self._meta.fields: if f.name == name: return f return None
def get_field_by_name(name): for f in self._meta.fields: if f.name == name: return f return None
453,679
def clean(self): super(TeacherInfoForm, self).clean() cleaned_data = self.cleaned_data
def clean(self): super(TeacherInfoForm, self).clean() cleaned_data = self.cleaned_data
453,680
def students_dict(self): from esp.program.models import RegistrationType now = datetime.datetime.now() rmap = RegistrationType.get_map() result = {} for key in rmap: result[key] = self.registrations.filter(studentregistration__relationship=rmap[key], studentregistration__start_date__lte=now, studentregistration__end_d...
def students_dict(self): from esp.program.models import RegistrationType now = datetime.datetime.now() rmap = RegistrationType.get_map() result = {} for key in rmap: result[key] = list(self.registrations.filter(studentregistration__relationship=rmap[key], studentregistration__start_date__lte=now, studentregistration__...
453,681
def students_dict(self): from esp.program.models import RegistrationType now = datetime.datetime.now() rmap = RegistrationType.get_map() result = {} for key in rmap: result[key] = self.registrations.filter(studentregistration__relationship=rmap[key], studentregistration__start_date__lte=now, studentregistration__end_d...
defstudents_dict.depend_on_row(lambda: StudentRegistration, lambda reg: {'self': reg.section}) students_dict(self):students_dict.depend_on_row(lambda: StudentRegistration, lambda reg: {'self': reg.section}) fromstudents_dict.depend_on_row(lambda: StudentRegistration, lambda reg: {'self': reg.section}) esp.program.mo...
453,682
def num_students_prereg(self): return self.students_prereg().count()
defnum_students_prereg.depend_on_row(lambda: StudentRegistration, lambda reg: {'self': reg.section}) @cache_function num_students_prereg(self):num_students_prereg.depend_on_row(lambda: StudentRegistration, lambda reg: {'self': reg.section}) @cache_function returnnum_students_prereg.depend_on_row(lambda: StudentRegist...
453,683
def clearStudents(self): from esp.program.models import StudentRegistration now = datetime.datetime.now() StudentRegistration.objects.filter(section=self, end_date__gte=now).update(end_date=now)
def clearStudents(self): from esp.program.models import StudentRegistration now = datetime.datetime.now() StudentRegistration.objects.filter(section=self, end_date__gte=now).update(end_date=now)
453,684
def execute(self): programs_to_archive = Program.objects.all()
def execute(self): programs_to_archive = Program.objects.all()
453,685
def _get_capacity(self, ignore_changes=False): if self.max_class_capacity is not None: ans = self.max_class_capacity
def _get_capacity(self, ignore_changes=False): if self.max_class_capacity is not None: ans = self.max_class_capacity
453,686
def texescape(value): """ This will escape a string according to the rules of LaTeX """ value = unicode(value).strip() special_backslash = '!**ABCDEF**!' # something unlikely to be repeated # we will make escape all the strings except those sandwiched between # $$ and $$. Thus you can write math symbols like $$\sqr...
def texescape(value): """ This will escape a string according to the rules of LaTeX """ value = unicode(value).strip() special_backslash = '!**ABCDEF**!' # something unlikely to be repeated # we will make escape all the strings except those sandwiched between # $$ and $$. Thus you can write math symbols like $$\sqr...
453,687
def module_properties(cls): return [ { "admin_title": "Show All Classes at Onsite Registration", "link_title": "List of All Classes", "module_type": "onsite", "seq": 31 }, { "admin_title": "Show Open Classes at Onsite Registration", "link_title": "List of Open Classes", "module_type": "onsite", "seq": 32, "main_call": ...
def module_properties(cls): return [ { "admin_title": "Show All Classes at Onsite Registration", "link_title": "List of All Classes", "module_type": "onsite", "seq": 31 }, { "admin_title": "Show Open Classes at Onsite Registration", "link_title": "List of Open Classes", "module_type": "onsite", "seq": 32, "main_call": ...
453,688
def __init__(self, newclslist): self.clslist = newclslist
def __init__(self, newclslist): self.clslist = newclslist
453,689
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
453,690
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
453,691
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
453,692
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
def runTest(self): # Parameters initial_capacity = 37 mult_test = 0.6 offset_test = 4 # Get class capacity self.program.getModules() options = self.program.getModuleExtension('StudentClassRegModuleInfo') sec = random.choice(list(self.program.sections())) sec.parent_class.class_size_max = initial_capacity sec.paren...
453,693
def isCompleted(self): """ Whether the user has paid for this program or its parent program. """ if ( len(Document.get_completed(self.user, self.program_anchor_cached)) > 0 ): return True else: parent_program = self.program.getParentProgram() if parent_program is not None: return ( len(Document.get_completed(self.user,...
def isCompleted(self): """ Whether the user has paid for this program or its parent program. """ if ( len(Document.get_completed(self.user, self.program_anchor_cached())) > 0 ): return True else: parent_program = self.program.getParentProgram() if parent_program is not None: return ( len(Document.get_completed(self.use...
453,694
def add_list_member(list, member): """ Add the e-mail address 'member' to the local Mailman mailing list 'list' "member" may be a list (or other iterable) of e-mail address strings, in which case all addresses will be added. """ if isinstance(member, User): member = member.email if hasattr(member, "filter"): member =...
def add_list_member(list, member): """ Add the e-mail address 'member' to the local Mailman mailing list 'list' "member" may be a list (or other iterable) of e-mail address strings, in which case all addresses will be added. """ if isinstance(member, User): member = member.email if hasattr(member, "filter"): member =...
453,695
def remove_list_member(list, member): """ Remove the e-mail address 'member' from the local Mailman mailing list 'list' "member" may be a list (or other iterable) of e-mail address strings, in which case all addresses will be removed. """ if isinstance(member, User): member = member.email if hasattr(member, "filter")...
def remove_list_member(list, member): """ Remove the e-mail address 'member' from the local Mailman mailing list 'list' "member" may be a list (or other iterable) of e-mail address strings, in which case all addresses will be removed. """ if isinstance(member, User): member = member.email if hasattr(member, "filter")...
453,696
def list_contents(list): """ Return the list of e-mail addresses on the specified mailing list """ return Popen([MM_PATH + "list_members", list]).communicate()[0].split('\n')
def list_contents(lst): """ Return the list of e-mail addresses on the specified mailing list """ return Popen([MM_PATH + "list_members", list]).communicate()[0].split('\n')
453,697
def list_contents(list): """ Return the list of e-mail addresses on the specified mailing list """ return Popen([MM_PATH + "list_members", list]).communicate()[0].split('\n')
def list_contents(list): """ Return the list of e-mail addresses on the specified mailing list """ return Popen([MM_PATH + "list_members", lst], stdout=PIPE, stderr=PIPE).communicate()[0].split('\n')
453,698
def catalog_student_count_json(self, request, tl, one, two, module, extra, prog, timeslot=None): clean_counts = prog.student_counts_by_section_id() resp = HttpResponse(mimetype='application/json') simplejson.dump(clean_counts, resp) return resp
def catalog_student_count_json(self, request, tl, one, two, module, extra, prog, timeslot=None): clean_counts = prog.student_counts_by_section_id() resp = HttpResponse(mimetype='application/json') simplejson.dump(clean_counts, resp) return resp
453,699