bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def editclass(self, request, tl, one, two, module, extra, prog): try: int(extra) except: raise ESPError("False"), "Invalid integer for class ID!"
def editclass(self, request, tl, one, two, module, extra, prog): try: int(extra) except: raise ESPError("False"), "Invalid integer for class ID!"
453,800
def __get__(self, request, obj_type=None): global get_user_django, ESPUser if not hasattr(request, '_cached_user'): if get_user is None or ESPUser is None or get_user_django is None: from django.contrib.auth import get_user as get_user_django from esp.users.models import ESPUser from esp.utils.get_user import get_user
def __get__(self, request, obj_type=None): global get_user_django, ESPUser, get_user if not hasattr(request, '_cached_user'): if get_user is None or ESPUser is None or get_user_django is None: from django.contrib.auth import get_user as get_user_django from esp.users.models import ESPUser from esp.utils.get_user import...
453,801
def render_to_latex(filepath, context_dict=None, filetype='pdf', landscape=None): """ Render some tex source to latex. This will run the latex interpreter and generate the necessary file type (either pdf, tex, ps, dvi, or a log file) """ from django.template import Context, Template, loader ## aseering 8-19-2010: Yes...
def render_to_latex(filepath, context_dict=None, filetype='pdf', landscape=None): """ Render some tex source to latex. This will run the latex interpreter and generate the necessary file type (either pdf, tex, ps, dvi, or a log file)""" from django.template import Context, Template, loader ## aseering 8-19-2010: Yes, t...
453,802
def render_to_latex(filepath, context_dict=None, filetype='pdf', landscape=None): """ Render some tex source to latex. This will run the latex interpreter and generate the necessary file type (either pdf, tex, ps, dvi, or a log file) """ from django.template import Context, Template, loader ## aseering 8-19-2010: Yes...
def render_to_latex(filepath, context_dict=None, filetype='pdf', landscape=None): """ Render some tex source to latex. This will run the latex interpreter and generate the necessary file type (either pdf, tex, ps, dvi, or a log file) """ from django.template import Context, Template, loader ## aseering 8-19-2010: Yes...
453,803
def friendly_times(self, use_cache=False, raw=False): """ Return a friendlier, prettier format for the times.
def friendly_times(self, use_cache=False, raw=False): """ Return a friendlier, prettier format for the times.
453,804
def clearslot_logic(self, request, tl, one, two, module, extra, prog): """ Clear the specified timeslot from a student registration and return True if there are no errors """ # The registration verb can be anything under this. v_registered_base = request.get_node('V/Flags/Registration') # This query just gets wor...
def clearslot_logic(self, request, tl, one, two, module, extra, prog): """ Clear the specified timeslot from a student registration and return oldclasses.values_list('id', flat=True) if there are no errors """ # The registration verb can be anything under this. v_registered_base = request.get_node('V/Flags/Registr...
453,805
def studentschedules(self, request, tl, one, two, module, extra, prog, onsite=False): """ generate student schedules """ context = {'module': self }
def studentschedules(self, request, tl, one, two, module, extra, prog, onsite=False): """ generate student schedules """ context = {'module': self }
453,806
def clean(self): super(UserContactForm, self).clean() if Tag.getTag('request_student_phonenum', default='True') != 'False': if self.cleaned_data.get('phone_day','') == '' and self.cleaned_data.get('phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") if self.cleaned_dat...
def clean(self): super(UserContactForm, self).clean() if Tag.getTag('request_student_phonenum', default='True') != 'False': if self.cleaned_data.get('phone_day','') == '' and self.cleaned_data.get('phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") if self.cleaned_dat...
453,807
def inline_cache_key(input_anchor, path, user=None): if user: return '%s_%s_%d_inline' % (input_anchor.id, path, user.id) else: return '%s_%s_anon_inline' % (input_anchor.id, path)
def inline_cache_key(input_anchor, path, user=None): if user and hasattr(user, 'id') and user.id is not None: return '%s_%s_%d_inline' % (input_anchor.id, path, user.id) else: return '%s_%s_anon_inline' % (input_anchor.id, path)
453,808
def __cmp__(self, other): selfevent = self.firstBlockEvent() otherevent = other.firstBlockEvent()
def __cmp__(self, other): selfevent = self.firstBlockEvent() otherevent = other.firstBlockEvent()
453,809
def getLists(self, QObjects=False): from esp.users.models import ESPUser lists = self.students(QObjects) lists.update(self.teachers(QObjects)) learnmodules = self.getModules(None) teachmodules = self.getModules(None)
def getLists(self, QObjects=False): from esp.users.models import ESPUser lists = self.students(QObjects) lists.update(self.teachers(QObjects)) learnmodules = self.getModules(None) teachmodules = self.getModules(None)
453,810
def getLists(self, QObjects=False): from esp.users.models import ESPUser lists = self.students(QObjects) lists.update(self.teachers(QObjects)) learnmodules = self.getModules(None) teachmodules = self.getModules(None)
def getLists(self, QObjects=False): from esp.users.models import ESPUser lists = self.students(QObjects) lists.update(self.teachers(QObjects)) learnmodules = self.getModules(None) teachmodules = self.getModules(None)
453,811
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,812
def get_section(self, timeslot=None): """ Cache sections for a class. Always use this function to get a class's sections. """
def get_section(self, timeslot=None): """ Cache sections for a class. Always use this function to get a class's sections. """
453,813
def get_section(self, timeslot=None): """ Cache sections for a class. Always use this function to get a class's sections. """
def get_section(self, timeslot=None): """ Cache sections for a class. Always use this function to get a class's sections. """
453,814
def userview(request): """ Render a template displaying all the information about the specified user """ try: user = ESPUser.objects.get(username=request.GET['username']) except: raise ESPError(False), "Sorry, can't find anyone with that username." teacherbio = TeacherBio.getLastBio(user) if not teacherbio.picture: te...
def userview(request): """ Render a template displaying all the information about the specified user """ try: user = ESPUser.objects.get(username=request.GET['username']) except: raise ESPError(False), "Sorry, can't find anyone with that username." teacherbio = TeacherBio.getLastBio(user) if not teacherbio.picture: te...
453,815
def user_has_TYPE(self, user, node, node_type='qsc'): """ Returns true if the user has the verb anywhere. False otherwise. """ node_id = getattr(node, 'id', node) col_filter = '%s__above' % node_type cache_key = 'has_%s__%s' % (node_type, node_id)
def user_has_TYPE(self, user, node, node_type='qsc'): """ Returns true if the user has the verb anywhere. False otherwise. """ node_id = getattr(node, 'id', node) col_filter = '%s__above' % node_type cache_key = 'has_%s__%s' % (node_type, node_id)
453,816
def clean_phone_cell(self): if self.cleaned_data.get('phone_day','') == '' and self.cleaned_data.get('phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") if self.cleaned_data.get('receive_txt_message', '') == '' and self.cleaned_data.get('phone_cell','') == '': raise f...
def clean_phone_cell(self): if self.cleaned_data.get('phone_day','') == '' and self.cleaned_data.get('phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") if self.cleaned_data.get('receive_txt_message', False) and self.cleaned_data.get('phone_cell','') == '': raise form...
453,817
def clean_emerg_phone_cell(self): if self.cleaned_data.get('emerg_phone_day','') == '' and self.cleaned_data.get('emerg_phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") return self.cleaned_data['phone_cell']
def clean_emerg_phone_cell(self): if self.cleaned_data.get('emerg_phone_day','') == '' and self.cleaned_data.get('emerg_phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") return self.cleaned_data['phone_cell']
453,818
def clean_guard_phone_cell(self): if self.cleaned_data.get('guard_phone_day','') == '' and self.cleaned_data.get('guard_phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") return self.cleaned_data['phone_cell']
def clean_guard_phone_cell(self): if self.cleaned_data.get('guard_phone_day','') == '' and self.cleaned_data.get('guard_phone_cell','') == '': raise forms.ValidationError("Please provide either a day phone or cell phone.") return self.cleaned_data['phone_cell']
453,819
def editclass(self, user, reg_data, clsid, form_class=TeacherClassRegForm): reg_form, resource_formset, restype_formset = self.get_forms(reg_data, form_class=form_class)
def editclass(self, user, reg_data, clsid, form_class=TeacherClassRegForm): reg_form, resource_formset, restype_formset = self.get_forms(reg_data, form_class=form_class)
453,820
def make_class_happen(self, cls, user, reg_form, resource_formset, restype_formset): self.set_class_data(cls, reg_form) self.update_class_sections(cls, int(reg_form.cleaned_data['num_sections'])) self.associate_teacher_with_class(cls, user) self.add_rsrc_requests_to_class(cls, resource_formset, restype_formset) cls.pro...
def make_class_happen(self, cls, user, reg_form, resource_formset, restype_formset, editing=False): self.set_class_data(cls, reg_form) self.update_class_sections(cls, int(reg_form.cleaned_data['num_sections'])) self.associate_teacher_with_class(cls, user) self.add_rsrc_requests_to_class(cls, resource_formset, restype_f...
453,821
def make_class_happen(self, cls, user, reg_form, resource_formset, restype_formset): self.set_class_data(cls, reg_form) self.update_class_sections(cls, int(reg_form.cleaned_data['num_sections'])) self.associate_teacher_with_class(cls, user) self.add_rsrc_requests_to_class(cls, resource_formset, restype_formset) cls.pro...
def make_class_happen(self, cls, user, reg_form, resource_formset, restype_formset): self.set_class_data(cls, reg_form) self.update_class_sections(cls, int(reg_form.cleaned_data['num_sections'])) if not editing: self.associate_teacher_with_class(cls, user) self.add_rsrc_requests_to_class(cls, resource_formset, restyp...
453,822
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,823
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,824
def render_class_core(cls): prog = cls.parent_program # Show enrollment? show_enrollment = prog.visibleEnrollments() # Okay, chose a program? Good. Now fetch the color from its hiding place and format it... colorstring = prog.getColor() if colorstring is not None: colorstring = ' background-color:#' + colorstring + ...
def render_class_core(cls): prog = cls.parent_program # Show enrollment? show_enrollment = prog.visibleEnrollments() # Okay, chose a program? Good. Now fetch the color from its hiding place and format it... colorstring = prog.getColor() if colorstring is not None: colorstring = ' background-color:#' + colorstring + ...
453,825
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,826
def paiditems(self, request, tl, one, two, module, extra, prog):
def paiditems(self, request, tl, one, two, module, extra, prog):
453,827
def paiditems(self, request, tl, one, two, module, extra, prog):
def paiditems(self, request, tl, one, two, module, extra, prog):
453,828
def setUp(self): config_file = os.path.join(srcdir, "../etc/pulp/pulp.ini") self.config = pulp.util.loadConfig(config_file) self.rapi = RepoApi(self.config) self.rapi.clean()
def setUp(self): config_file = os.path.join(srcdir, "../etc/pulp/pulp.ini") self.config = pulp.util.load_config(config_file) self.rapi = RepoApi(self.config) self.rapi.clean()
453,829
def _load_core(self, name): mod = __import__('pulp.client.core.', globals(), locals(), [name]) try: submod = getattr(mod, name) except AttributeError: return None return getattr(submod, core)
def _load_core(self, name): mod = __import__('pulp.client.core.', globals(), locals(), [name]) try: submod = getattr(mod, name) except AttributeError: return None return getattr(submod, core)
453,830
def setup_parser(self): default = None help = _('consumer id (required)') consumerid = self.getconsumerid() if consumerid is not None: default = consumerid help = SUPPRESS_HELP self.parser.add_option("--consumerid", dest="consumerid", default=default, help=help) self.parser.add_option("--repoid", dest="repoid", help=_(...
def setup_parser(self): default = None consumerid = self.getconsumerid() if consumerid is not None: default = consumerid help = SUPPRESS_HELP self.parser.add_option("--consumerid", dest="consumerid", default=default, help=help) self.parser.add_option("--repoid", dest="repoid", help=_("repository id")) self.parser.add_o...
453,831
def setup_parser(self): default = None help = _('consumer id (required)') consumerid = self.getconsumerid() if consumerid is not None: default = consumerid help = SUPPRESS_HELP self.parser.add_option("--consumerid", dest="consumerid", default=default, help=help) self.parser.add_option("--repoid", dest="repoid", help=_(...
def setup_parser(self): default = None help = _('consumer id (required)') consumerid = self.getconsumerid() if consumerid is not None: default = consumerid help = SUPPRESS_HELP self.parser.add_option("--consumerid", dest="consumerid", default=default, help=_('This option is required if a consumer doesn\'t exist locally...
453,832
def run(self): consumerid = self.opts.consumerid repoid = self.opts.repoid if not (consumerid or repoid): system_exit(os.EX_USAGE, _("A consumer or a repository is required to lookup errata")) if repoid: errata = self.rconn.errata(repoid, self.opts.type) elif consumerid: errata = self.cconn.errata(consumerid, self.opts...
def run(self): consumerid = self.opts.consumerid repoid = self.opts.repoid if not (consumerid or repoid): system_exit(os.EX_USAGE, _("A consumer or a repository is required to lookup errata")) if repoid: errata = self.rconn.errata(repoid, self.opts.type) elif consumerid: errata = self.cconn.errata(consumerid, self.opts...
453,833
def run(self): id = self.get_required_option('id') errata = self.econn.erratum(id) effected_pkgs = [str(pinfo['filename']) for pkg in errata['pkglist'] for pinfo in pkg['packages']] print constants.ERRATA_INFO % (errata['id'], errata['title'], errata['description'], errata['type'], errata['issued'], errata['updated'], ...
def run(self): id = self.get_required_option('id') errata = self.econn.erratum(id) effected_pkgs = [str(pinfo['filename']) for pkg in errata['pkglist'] for pinfo in pkg['packages']] print constants.ERRATA_INFO % (errata['id'], errata['title'], errata['description'], errata['type'], errata['issued'], errata['updated'], ...
453,834
def test_create_groups_metadata(self): repo_path = os.path.join(self.data_path, "no_groups_repo") repo = self.rapi.create("test_create_groups_metadata_id", 'test_import_groups_data_id', 'i386', 'local:file://%s' % (repo_path)) self.rapi.sync(repo["id"]) found = self.rapi.packagegroups(repo['id']) self.assertTrue(len(fo...
def test_create_groups_metadata(self): repo_path = os.path.join(self.data_path, "no_groups_repo") repo = self.rapi.create("test_create_groups_metadata_id", 'test_import_groups_data_id', 'i386', 'local:file://%s' % (repo_path)) self.rapi.sync(repo["id"]) found = self.rapi.packagegroups(repo['id']) self.assertTrue(len(fo...
453,835
def __exit__(self, *args, **kwargs): self.release()
def __exit__(self, *args, **kwargs): self.release()
453,836
def start(self): parent = threading.current_thread() _thread_tree.setdefault(parent, []).append(self) super(TrackableThread, self).start()
def start(self): parent = threading.current_thread() _thread_tree.setdefault(parent, []).append(self) super(TrackableThread, self).start()
453,837
def start(self): parent = threading.current_thread() _thread_tree.setdefault(parent, []).append(self) super(TrackableThread, self).start()
def start(self): parent = threading.current_thread() _thread_tree.setdefault(parent, []).append(self) super(TrackableThread, self).start()
453,838
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: TrackableThread instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackableThread @return: list of TrackableThread instances """ if not isinstanc...
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: L{TrackedThread} instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackableThread @return: list of TrackableThread instances """ if not isinstan...
453,839
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: TrackableThread instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackableThread @return: list of TrackableThread instances """ if not isinstanc...
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: TrackableThread instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackedThread @return: list of TrackedThread instances """ if not isinstance(th...
453,840
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: TrackableThread instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackableThread @return: list of TrackableThread instances """ if not isinstanc...
def def remove_subtree(thread): if not isinstance(thread, TrackedThread): raise RuntimeError('Cannot clear subtree of an untracked thread') descendents = _thread_tree.pop(thread, []) for d in descendents: descendents.extend(_thread_tree.pop(d, [])) return len(descendents) get_descendants(thread): def remove_subtree(t...
453,841
def _raise_exception_in_thread(tid, exc_type): """ Raises an exception in the threads with id tid. """ assert inspect.isclass(exc_type) # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) long_tid = ctypes.c_long(tid) exc_ptr = ctypes.py_object(exc_t...
def _raise_exception_in_thread(tid, exc_type): """ Raises an exception in the threads with id tid. """ assert inspect.isclass(exc_type) # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) long_tid = ctypes.c_long(tid) exc_ptr = ctypes.py_object(exc_t...
453,842
def __init__(self, *args, **kwargs): super(InterruptableThread, self).__init__(*args, **kwargs) self.__default_timeout = 0.05 self.__exception_event = threading.Event()
def __init__(self, *args, **kwargs): super(TaskThread, self).__init__(*args, **kwargs) self.__default_timeout = 0.05 self.__exception_event = threading.Event()
453,843
def __init__(self, *args, **kwargs): super(InterruptableThread, self).__init__(*args, **kwargs) self.__default_timeout = 0.05 self.__exception_event = threading.Event()
def __init__(self, *args, **kwargs): super(InterruptableThread, self).__init__(*args, **kwargs) self.__default_timeout = 0.05 self.__exception_event = threading.Event()
453,844
def raise_exception(self, exc_type): """ Raise and exception in this thread. NOTE this is executed in the context of the calling thread and blocks until the exception has been delivered to this thread and this thread exists. """ while not self.__exception_event.is_set(): try: _raise_exception_in_thread(self._tid, exc_...
def raise_exception(self, exc_type): """ Raise and exception in this thread. NOTE this is executed in the context of the calling thread and blocks until the exception has been delivered to this thread and this thread exists. """ while not self.__exception_event.is_set(): try: _raise_exception_in_thread(_tid(self), exc...
453,845
def raise_exception(self, exc_type): """ Raise and exception in this thread. NOTE this is executed in the context of the calling thread and blocks until the exception has been delivered to this thread and this thread exists. """ while not self.__exception_event.is_set(): try: _raise_exception_in_thread(self._tid, exc_...
def raise_exception(self, exc_type): """ Raise and exception in this thread. NOTE this is executed in the context of the calling thread and blocks until the exception has been delivered to this thread and this thread exists. """ while not self.__exception_event.is_set(): try: _raise_exception_in_thread(self._tid, exc_...
453,846
def __init__(self, *dec_args, **dec_kw): '''The decorator arguments are passed here. Save them for runtime.''' self.dec_args = dec_args self.dec_kw = dec_kw
defself.user_api = UserApi() self.consumer_api = ConsumerApi() __init__(self,self.user_api = UserApi() self.consumer_api = ConsumerApi() *dec_args,self.user_api = UserApi() self.consumer_api = ConsumerApi() **dec_kw):self.user_api = UserApi() self.consumer_api = ConsumerApi() '''Theself.user_api = UserApi() self.co...
453,847
def _validate_user_exists(self, username): user = USER_API.user(username) if user is None: LOG.error('User [%s] specified in certificate was not found in the system' % username) return None return user
def _validate_user_exists(self, username): user = self.user_api.user(username) if user is None: LOG.error('User [%s] specified in certificate was not found in the system' % username) return None return user
453,848
def check_consumer(self, check_id=False, *fargs): ''' Determines if the certificate in the request represents a valid consumer certificate.
def check_consumer(self, check_id=False, *fargs): ''' Determines if the certificate in the request represents a valid consumer certificate.
453,849
def run(self): errataids = self.args
def run(self): errataids = self.args
453,850
def run(self): errataids = self.args
def run(self): errataids = self.args
453,851
def remove_package(self, repoid, p): """Note: This method does not update repo metadata. It is assumed metadata has already been updated. """ repo = self._get_existing_repo(repoid) # this won't fail even if the package is not in the repo's packages repo['packages'].pop(p['id'], None) self.objectdb.save(repo, safe=True)...
def remove_package(self, repoid, p): """Note: This method does not update repo metadata. It is assumed metadata has already been updated. """ repo = self._get_existing_repo(repoid) # this won't fail even if the package is not in the repo's packages repo['packages'].pop(p['id'], None) self.objectdb.save(repo, safe=True)...
453,852
def _add_consumer(self): if not self.options.consumerid: print("consumer id required. Try --help") sys.exit(0) if not self.options.groupid: print("group id required. Try --help") sys.exit(0) try: self.cgconn.add_consumer(self.options.groupid, self.options.consumerid) print _(" Successfully added Consumer [%s] to Group ...
def _add_consumer(self): if not self.options.consumerid: print("consumer id required. Try --help") sys.exit(0) if not self.options.groupid: print("group id required. Try --help") sys.exit(0) try: self.cgconn.add_consumer(self.options.groupid, self.options.consumerid) print _(" Successfully added Consumer [%s] to Group ...
453,853
def test_repo_packages(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') package = Package('test_repo_packages','test package') repo.packages[package.id] = package self.rapi.update(repo) found = self.rapi.repository('some-id') packages = found['packages'] assert(packages != None...
def test_repo_packages(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') package = Package('test_repo_packages','test package') repo.packages[package["packageid"]] = package self.rapi.update(repo) found = self.rapi.repository('some-id') packages = found['packages'] assert(packag...
453,854
def test_repo_package_groups(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') pkggroup = PackageGroup('test-group-id', 'test-group-name', 'test-group-description') package = Package('test_repo_packages','test package') pkggroup.default_package_names.append(package.id) repo.packa...
def test_repo_package_groups(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') pkggroup = PackageGroup('test-group-id', 'test-group-name', 'test-group-description') package = Package('test_repo_packages','test package') pkggroup.default_package_names.append(package["packageid"]) ...
453,855
def test_repo_package_group_categories(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') package = Package('test_repo_packages','test package') pkggroup = PackageGroup('test-group-id', 'test-group-name', 'test-group-description') pkggroup.default_package_names.append(package.id) ...
def test_repo_package_group_categories(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') package = Package('test_repo_packages','test package') pkggroup = PackageGroup('test-group-id', 'test-group-name', 'test-group-description') pkggroup.default_package_names.append(package["pac...
453,856
def test_repo_package_group_categories(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') package = Package('test_repo_packages','test package') pkggroup = PackageGroup('test-group-id', 'test-group-name', 'test-group-description') pkggroup.default_package_names.append(package.id) ...
def test_repo_package_group_categories(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') package = Package('test_repo_packages','test package') pkggroup = PackageGroup('test-group-id', 'test-group-name', 'test-group-description') pkggroup.default_package_names.append(package.id) ...
453,857
def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') package = Package('test_consumerwithpackage','test package search') c.packageids.append(package.id) for i in range(10): package = Package(randomString(), randomString()) c.packageids.append(package.id) self.capi.update(c) f...
def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') package = Package('test_consumerwithpackage','test package search') c.packageids.append(package["packageid"]) for i in range(10): package = Package(randomString(), randomString()) c.packageids.append(package["packageid"]) se...
453,858
def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') package = Package('test_consumerwithpackage','test package search') c.packageids.append(package.id) for i in range(10): package = Package(randomString(), randomString()) c.packageids.append(package.id) self.capi.update(c) f...
def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') package = Package('test_consumerwithpackage','test package search') c.packageids.append(package["packageid"]) for i in range(10): package = Package(randomString(), randomString()) c.packageids.append(package["packageid"]) se...
453,859
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: L{TrackedThread} instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackedThread @return: list of TrackedThread instances """ if not isinstance(t...
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: L{TrackedThread} instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackedThread @return: list of TrackedThread instances """ if not isinstance(t...
453,860
def _create_socket(config): #address = config.get('server', 'address') #port = config.getint('server', 'port') address = '127.0.0.1' port = 8811 socket = gevent.socket.tcp_listener((address, port)) #if config.getbool('server', 'use_ssl'): if False: keyfile = config.get('ssl', 'keyfile') certfile = config.get('ssl', 'ce...
def _create_socket(config): #address = config.get('server', 'address') #port = config.getint('server', 'port') address = '127.0.0.1' port = 8811 socket = gevent.socket.tcp_listener((address, port)) #if config.getbool('server', 'use_ssl'): if False: keyfile = config.get('ssl', 'keyfile') certfile = config.get('ssl', 'ce...
453,861
def _create_socket(config): #address = config.get('server', 'address') #port = config.getint('server', 'port') address = '127.0.0.1' port = 8811 socket = gevent.socket.tcp_listener((address, port)) #if config.getbool('server', 'use_ssl'): if False: keyfile = config.get('ssl', 'keyfile') certfile = config.get('ssl', 'ce...
def _create_socket(config): #address = config.get('server', 'address') #port = config.getint('server', 'port') address = '127.0.0.1' port = 8811 socket = gevent.socket.tcp_listener((address, port)) #if config.getbool('server', 'use_ssl'):if config.getboolean('server', 'use_ssl'): keyfile = config.get('ssl', 'keyfile')...
453,862
def perform(self): """ Looks up the consumer id and latest pkg profile info and cals the api to update the consumer profile """ bundle = Consumer() cid = bundle.getid() if not cid.exists(): log.error("Not Registered") return try: cconn = ConsumerConnection(host=cfg.server.host or "localhost", port=cfg.server.port or 44...
def perform(self): """ Looks up the consumer id and latest pkg profile info and cals the api to update the consumer profile """ bundle = Consumer() cid = bundle.getid() if not cid: log.error("Not Registered") return try: cconn = ConsumerConnection(host=cfg.server.host or "localhost", port=cfg.server.port or 443) pkginf...
453,863
def perform(self): """ Looks up the consumer id and latest pkg profile info and cals the api to update the consumer profile """ bundle = Consumer() cid = bundle.getid() if not cid.exists(): log.error("Not Registered") return try: cconn = ConsumerConnection(host=cfg.server.host or "localhost", port=cfg.server.port or 44...
def perform(self): """ Looks up the consumer id and latest pkg profile info and cals the api to update the consumer profile """ bundle = Consumer() cid = bundle.getid() if not cid.exists(): log.error("Not Registered") return try: cconn = ConsumerConnection(host=cfg.server.host or "localhost", port=cfg.server.port or 44...
453,864
def test_task_find(self): task1 = Task(noop) self.queue.enqueue(task1) task2 = self.queue.find(id=task1.id) self.assertTrue(task1 is task2)
def test_task_find(self): task1 = Task(noop) self.queue.enqueue(task1) task2 = self.queue.find(id=task1.id)[0] self.assertTrue(task1 is task2)
453,865
def test_find_invalid_criteria(self): # Setup task1 = Task(noop) self.queue.enqueue(task1)
def test_find_invalid_criteria(self): # Setup task1 = Task(noop) self.queue.enqueue(task1)
453,866
def test_find_empty_queue(self): # Test found = self.queue.find(id=1)
def test_find_empty_queue(self): # Test found = self.queue.find(id=1)
453,867
def test_find_multiple_criteria(self): # Setup task1 = Task(noop) self.queue.enqueue(task1)
def test_find_multiple_criteria(self): # Setup task1 = Task(noop) self.queue.enqueue(task1)
453,868
def test_find_multiple_matching(self): # Setup task1 = Task(noop) task2 = Task(noop)
def test_find_multiple_matching(self): # Setup task1 = Task(noop) task2 = Task(noop)
453,869
def test_task_status(self): task = Task(noop) self.queue.enqueue(task) self._wait_for_task(task) status = self.queue.find(id=task.id) self.assertTrue(status.state == task.state)
def test_task_status(self): task = Task(noop) self.queue.enqueue(task) self._wait_for_task(task) status = self.queue.find(id=task.id) self.assertTrue(status.state == task.state)
453,870
def test_create_groups_metadata(self): repo_path = os.path.join(self.data_path, "no_groups_repo") repo = self.rapi.create("test_create_groups_metadata_id", 'test_import_groups_data_id', 'i386', 'local:file://%s' % (repo_path)) self.rapi._sync(repo["id"]) found = self.rapi.packagegroups(repo['id']) self.assertTrue(len(f...
def test_create_groups_metadata(self): repo_path = os.path.join(self.data_path, "no_groups_repo") repo = self.rapi.create("test_create_groups_metadata_id", 'test_import_groups_data_id', 'i386', 'local:file://%s' % (repo_path)) self.rapi._sync(repo["id"]) found = self.rapi.packagegroups(repo['id']) self.assertTrue(len(f...
453,871
def test_create_groups_metadata(self): repo_path = os.path.join(self.data_path, "no_groups_repo") repo = self.rapi.create("test_create_groups_metadata_id", 'test_import_groups_data_id', 'i386', 'local:file://%s' % (repo_path)) self.rapi._sync(repo["id"]) found = self.rapi.packagegroups(repo['id']) self.assertTrue(len(f...
def test_create_groups_metadata(self): repo_path = os.path.join(self.data_path, "no_groups_repo") repo = self.rapi.create("test_create_groups_metadata_id", 'test_import_groups_data_id', 'i386', 'local:file://%s' % (repo_path)) self.rapi._sync(repo["id"]) found = self.rapi.packagegroups(repo['id']) self.assertTrue(len(f...
453,872
def POST(self, id): """ Bind (subscribe) a user to a repository. @param id: consumer id @return: True on successful bind """ data = self.input() API.bind(id, data['repoid']) return self.output(True)
def POST(self, id): """ Bind (subscribe) a user to a repository. @param id: consumer id @return: True on successful bind """ data = self.input() API.bind(id, data) return self.output(True)
453,873
def POST(self, id): """ Unbind (unsubscribe) a user to a repository. @param id: consumer id @return: True on successful unbind """ data = self.input() API.unbind(id, data['repoid']) return self.output(True)
def POST(self, id): """ Unbind (unsubscribe) a user to a repository. @param id: consumer id @return: True on successful unbind """ data = self.input() API.unbind(id, data) return self.output(True)
453,874
def check_admin_cert(self, *fargs): ''' Determines if the certificate in the request represents a valid admin certificate.
def check_admin_cert(self, *fargs): ''' Determines if the certificate in the request represents a valid admin certificate.
453,875
def _update_errata_packages(self, repoid, errataids=[], action=None): repo = self._get_existing_repo(repoid) for erratumid in errataids: erratum = self.errataapi.erratum(erratumid) if erratum is None: log.info("No Erratum with id: %s found" % erratumid) continue addids = [] rmids = [] for pkg in erratum['pkglist']: fo...
def _update_errata_packages(self, repoid, errataids=[], action=None): repo = self._get_existing_repo(repoid) for erratumid in errataids: erratum = self.errataapi.erratum(erratumid) if erratum is None: log.info("No Erratum with id: %s found" % erratumid) continue for pkg in erratum['pkglist']: for pinfo in pkg['package...
453,876
def run(self): id = self.get_required_option('id') if not self.opts.pkgname: system_exit(os.EX_USAGE, _("Error, atleast one package id is required to perform an add.")) if not self.opts.srcrepo: system_exit(os.EX_USAGE, _("Error, a source respository where packages exists is required")) pids = [] for pkg in self.opts.p...
def run(self): id = self.get_required_option('id') if not self.opts.pkgname: system_exit(os.EX_USAGE, _("Error, atleast one package id is required to perform an add.")) if not self.opts.srcrepo: system_exit(os.EX_USAGE, _("Error, a source respository where packages exists is required")) pids = [] for pkg in self.opts.p...
453,877
def run(self): id = self.get_required_option('id') if not self.opts.errataid: system_exit(os.EX_USAGE, _("Error, atleast one erratum id is required to perform an add.")) if not self.opts.srcrepo: system_exit(os.EX_USAGE, _("Error, a source respository where erratum exists is required")) errataids = self.opts.errataid t...
def run(self): id = self.get_required_option('id') if not self.opts.errataid: system_exit(os.EX_USAGE, _("Error, atleast one erratum id is required to perform an add.")) if not self.opts.srcrepo: system_exit(os.EX_USAGE, _("Error, a source respository where erratum exists is required")) errataids = self.opts.errataid t...
453,878
def run(self): id = self.get_required_option('id') if not self.opts.errataid: system_exit(os.EX_USAGE, _("Error, atleast one erratum id is required to perform a delete.")) errataids = self.opts.errataid try: self.pconn.delete_errata(id, errataids) except Exception: print _("Unable to remove errata [%s] to repo [%s]" % ...
def run(self): id = self.get_required_option('id') if not self.opts.errataid: system_exit(os.EX_USAGE, _("Error, atleast one erratum id is required to perform a delete.")) errataids = self.opts.errataid try: self.pconn.delete_errata(id, errataids) except Exception: print _("Unable to remove errata [%s] to repo [%s]" % ...
453,879
def run(self): resource = self.get_required_option('resource') perms = self.perm_conn.show_permissions(resource) if perms is None: system_exit(os.EX_SOFTWARE) print_header(_('Permissions for %') % resource) for user, operations in perms['users'].items(): print ' %s \t%-25s' % (user, ', '.join(operations...
def run(self): resource = self.get_required_option('resource') perms = self.perm_conn.show_permissions(resource) if perms is None: system_exit(os.EX_SOFTWARE) print_header(_('Permissions for %s') % resource) for user, operations in perms['users'].items(): print ' %s \t%-25s' % (user, ', '.join(operation...
453,880
def run(self): resource = self.get_required_option('resource') perms = self.perm_conn.show_permissions(resource) if perms is None: system_exit(os.EX_SOFTWARE) print_header(_('Permissions for %') % resource) for user, operations in perms['users'].items(): print ' %s \t%-25s' % (user, ', '.join(operations...
def run(self): resource = self.get_required_option('resource') perms = self.perm_conn.show_permissions(resource) if perms is None: system_exit(os.EX_SOFTWARE) print_header(_('Permissions for %') % resource) for user, operations in perms['users'].items(): print ' %s \t%-25s' % (user, ', '.join(operations...
453,881
def test_sync_two_repos_share_common_package(self): """ Sync 2 repos that share a common package, same NEVRA same checksum """ test_pkg_name = "pulp-test-package" my_dir = os.path.abspath(os.path.dirname(__file__)) repo_name_a = "test_two_repos_share_common_pkg_repo_A" repo_name_b = "test_two_repos_share_common_pkg_rep...
def test_sync_two_repos_share_common_package(self): """ Sync 2 repos that share a common package, same NEVRA same checksum """ test_pkg_name = "pulp-test-package" my_dir = os.path.abspath(os.path.dirname(__file__)) repo_name_a = "test_two_repos_share_common_pkg_repo_A" repo_name_b = "test_two_repos_share_common_pkg_rep...
453,882
def test_sync_two_repos_share_common_package(self): """ Sync 2 repos that share a common package, same NEVRA same checksum """ test_pkg_name = "pulp-test-package" my_dir = os.path.abspath(os.path.dirname(__file__)) repo_name_a = "test_two_repos_share_common_pkg_repo_A" repo_name_b = "test_two_repos_share_common_pkg_rep...
def test_sync_two_repos_share_common_package(self): """ Sync 2 repos that share a common package, same NEVRA same checksum """ test_pkg_name = "pulp-test-package" my_dir = os.path.abspath(os.path.dirname(__file__)) repo_name_a = "test_two_repos_share_common_pkg_repo_A" repo_name_b = "test_two_repos_share_common_pkg_rep...
453,883
def _request(self, request_type, method, info=None): handler = self.apihandler + method log.debug("_request calling: %s to host:port : %s:%s" % (handler, self.host, self.port)) if self.cert_file: log.info("Using SSLv3 context") context = SSL.Context("sslv3") context.load_cert(self.cert_file, keyfile=self.key_file) conn...
def _request(self, request_type, method, info=None): handler = method if not handler.startswith(self.apihandler): handler = '/'.join((self.apihandler, handler)) log.debug("_request calling: %s to host:port : %s:%s" % (handler, self.host, self.port)) if self.cert_file: log.info("Using SSLv3 context") context = SSL.Cont...
453,884
def install(self, packageinfo, reboot_suggested=False, assumeyes=False): """ Install packages by name. @param packageinfo: A list of strings for pkg names or tuples for name/arch info. @type packageinfo: str or tuple """ installed = [] yb = YumBase() log.info('installing packages: %s', packageinfo) for info in packagei...
def install(self, packageinfo, reboot_suggested=False, assumeyes=False): """ Install packages by name. @param packageinfo: A list of strings for pkg names or tuples for name/arch info. @type packageinfo: str or tuple """ installed = [] yb = YumBase() log.info('installing packages: %s', packageinfo) for info in packagei...
453,885
def install(self, packageinfo, reboot_suggested=False, assumeyes=False): """ Install packages by name. @param packageinfo: A list of strings for pkg names or tuples for name/arch info. @type packageinfo: str or tuple """ installed = [] yb = YumBase() log.info('installing packages: %s', packageinfo) for info in packagei...
def install(self, packageinfo, reboot_suggested=False, assumeyes=False): """ Install packages by name. @param packageinfo: A list of strings for pkg names or tuples for name/arch info. @type packageinfo: str or tuple """ installed = [] yb = YumBase() log.info('installing packages: %s', packageinfo) for info in packagei...
453,886
def _update_errata_packages(self, repoid, errataids=[], action=None): repo = self._get_existing_repo(repoid) addids = [] rmids = [] for erratumid in errataids: erratum = self.errataapi.erratum(erratumid) if erratum is None: log.info("No Erratum with id: %s found" % erratumid) continue for pkg in erratum['pkglist']: fo...
def _update_errata_packages(self, repoid, errataids=[], action=None): repo = self._get_existing_repo(repoid) addids = [] rmids = [] for erratumid in errataids: erratum = self.errataapi.erratum(erratumid) if erratum is None: log.info("No Erratum with id: %s found" % erratumid) continue for pkg in erratum['pkglist']: fo...
453,887
def __init__(self, code, msg = ""): self.code = code self.msg = msg
def __init__(self, code, msg=""): self.code = code self.msg = msg
453,888
def __init__(self, host, port, apihandler, cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = apihandler self.username = username self.password = password if (self.u...
def __init__(self, host, port, apihandler, apiprefix='/pulp/api', cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = apihandler self.username = username self.passwor...
453,889
def __init__(self, host, port, apihandler, cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = apihandler self.username = username self.password = password if (self.u...
def __init__(self, host, port, apihandler, cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = ''.join((apiprefix, apihandler)) self.username = username self.password...
453,890
def __init__(self, host, port, apihandler, cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = apihandler self.username = username self.password = password if (self.u...
def __init__(self, host, port, apihandler, cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = apihandler self.username = username self.password = password if (self.u...
453,891
def _request(self, request_type, method, info=None): handler = self.apihandler + method log.debug("_request calling: %s to host:port : %s:%s" % (handler, self.host, type(self.port))) if self.cert_file: log.info("Using SSLv3 context") context = SSL.Context("sslv3") context.load_cert(self.cert_file, keyfile=self.key_file...
def _request(self, request_type, method, info=None): handler = self.apihandler + method log.debug("_request calling: %s to host:port : %s:%s" % (handler, self.host, type(self.port))) if self.cert_file: log.info("Using SSLv3 context") context = SSL.Context("sslv3") context.load_cert(self.cert_file, keyfile=self.key_file...
453,892
def __init__(self, host='localhost', port=8811, handler="", cert_file=None, key_file=None, username=None, password=None): self.host = host self.port = port self.handler = handler self.conn = None self.cert_file = cert_file self.key_file = key_file self.username = username self.password = password # initialize connectio...
def __init__(self, host='localhost', port=443, handler="", cert_file=None, key_file=None, username=None, password=None): self.host = host self.port = port self.handler = handler self.conn = None self.cert_file = cert_file self.key_file = key_file self.username = username self.password = password # initialize connection...
453,893
def setUp(self): self.conn = Restlib(self.host, self.port, self.handler, self.cert_file, self.key_file, self.username, self.password) log.info("Connection Established for cli: Host: %s, Port: %s, handler: %s" % (self.host, self.port, self.handler)) log.info("Using cert_file: %s and key_file: %s" % (self.cert_file, self...
def setUp(self): self.conn = Restlib(self.host, self.port, self.handler, cert_file=self.cert_file, key_file=self.key_file, username=self.username, password=self.password) log.info("Connection Established for cli: Host: %s, Port: %s, handler: %s" % (self.host, self.port, self.handler)) log.info("Using cert_file: %s and ...
453,894
def setUp(self): self.conn = Restlib(self.host, self.port, self.handler, self.cert_file, self.key_file, self.username, self.password) log.info("Connection Established for cli: Host: %s, Port: %s, handler: %s" % (self.host, self.port, self.handler)) log.info("Using cert_file: %s and key_file: %s" % (self.cert_file, self...
def setUp(self): self.conn = Restlib(self.host, self.port, self.handler, self.cert_file, self.key_file, self.username, self.password) log.info("Connection Established for cli: Host: %s, Port: %s, handler: %s" % (self.host, self.port, self.handler)) log.info("Using cert_file: %s and key_file: %s" % (self.cert_file, self...
453,895
def create(self, id, name, arch, feed=None, symlinks=False, sync_schedule=None, cert_data=None): method = "/repositories/" repodata = {"id" : id, "name" : name, "arch" : arch, "feed" : feed, "use_symlinks" : symlinks, "sync_schedule" : sync_schedule, "cert_data" : cert_data} return self.conn.request_put(method, p...
def create(self, id, name, arch, feed=None, symlinks=False, sync_schedule=None, cert_data=None): method = "/repositories/" repodata = {"id" : id, "name" : name, "arch" : arch, "feed" : feed, "use_symlinks" : symlinks, "sync_schedule" : sync_schedule, "cert_data" : cert_data} return self.conn.request_put(method, p...
453,896
def packagegroups(self, repoid): method = "/repositories/%s/packagegroups/" % repoid return self.conn.request_get(method)
def packagegroups(self, repoid): method = "/repositories/%s/packagegroups/" % repoid return self.conn.request_get(method)
453,897
def create_packagegroup(self, repoid, groupid, groupname, description): method = "/repositories/%s/create_packagegroup/" % repoid return self.conn.request_post(method, params={"groupid":groupid, "groupname":groupname, "description":description})
def create_packagegroup(self, repoid, groupid, groupname, description): method = "/repositories/%s/create_packagegroup/" % repoid return self.conn.request_post(method, params={"groupid":groupid, "groupname":groupname, "description":description})
453,898
def delete_packagegroup(self, repoid, groupid): method = "/repositories/%s/delete_packagegroup/" % repoid return self.conn.request_post(method, params={"groupid":groupid})
def delete_packagegroup(self, repoid, groupid): method = "/repositories/%s/delete_packagegroup/" % repoid return self.conn.request_post(method, params={"groupid":groupid})
453,899