From 22bbdacee9ca03a61f6de12e7082cfa9addaaa9a Mon Sep 17 00:00:00 2001 From: Sarina Canelake Date: Fri, 10 Jul 2015 11:31:45 -0400 Subject: [PATCH] Convert Meta classes to new-style classes --- common/djangoapps/course_action_state/managers.py | 2 +- common/djangoapps/course_action_state/models.py | 6 +++--- common/djangoapps/course_modes/admin.py | 2 +- common/djangoapps/course_modes/models.py | 2 +- common/djangoapps/django_comment_common/models.py | 4 ++-- common/djangoapps/embargo/forms.py | 4 ++-- common/djangoapps/embargo/models.py | 6 +++--- common/djangoapps/external_auth/models.py | 2 +- common/djangoapps/student/admin.py | 4 ++-- common/djangoapps/student/models.py | 12 ++++++------ common/djangoapps/track/backends/django.py | 2 +- lms/djangoapps/ccx/models.py | 2 +- lms/djangoapps/certificates/models.py | 4 ++-- lms/djangoapps/shoppingcart/models.py | 2 +- lms/djangoapps/verify_student/models.py | 4 ++-- openedx/core/djangoapps/course_groups/models.py | 2 +- .../core/djangoapps/user_api/accounts/serializers.py | 6 +++--- openedx/core/djangoapps/user_api/models.py | 6 +++--- openedx/core/djangoapps/user_api/serializers.py | 6 +++--- 19 files changed, 39 insertions(+), 39 deletions(-) diff --git a/common/djangoapps/course_action_state/managers.py b/common/djangoapps/course_action_state/managers.py index 96f82300e7..3bda32e501 100644 --- a/common/djangoapps/course_action_state/managers.py +++ b/common/djangoapps/course_action_state/managers.py @@ -10,7 +10,7 @@ class CourseActionStateManager(models.Manager): An abstract Model Manager class for Course Action State models. This abstract class expects child classes to define the ACTION (string) field. """ - class Meta: + class Meta(object): """Abstract manager class, with subclasses defining the ACTION (string) field.""" abstract = True diff --git a/common/djangoapps/course_action_state/models.py b/common/djangoapps/course_action_state/models.py index 61aaf9e263..87fceebed7 100644 --- a/common/djangoapps/course_action_state/models.py +++ b/common/djangoapps/course_action_state/models.py @@ -21,7 +21,7 @@ class CourseActionState(models.Model): For example: course copying (reruns), import, export, and validation. """ - class Meta: + class Meta(object): """ For performance reasons, we disable "concrete inheritance", by making the Model base class abstract. With the "abstract base class" inheritance model, tables are only created for derived models, not for @@ -77,7 +77,7 @@ class CourseActionUIState(CourseActionState): """ An abstract django model that is a sub-class of CourseActionState with additional fields related to UI. """ - class Meta: + class Meta(object): """ See comment in CourseActionState on disabling "concrete inheritance". """ @@ -101,7 +101,7 @@ class CourseRerunState(CourseActionUIState): """ A concrete django model for maintaining state specifically for the Action Course Reruns. """ - class Meta: + class Meta(object): """ Set the (destination) course_key field to be unique for the rerun action Although multiple reruns can be in progress simultaneously for a particular source course_key, diff --git a/common/djangoapps/course_modes/admin.py b/common/djangoapps/course_modes/admin.py index 3b4cebdb9c..ac3c9efaa4 100644 --- a/common/djangoapps/course_modes/admin.py +++ b/common/djangoapps/course_modes/admin.py @@ -16,7 +16,7 @@ from util.date_utils import get_time_display class CourseModeForm(forms.ModelForm): - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = CourseMode COURSE_MODE_SLUG_CHOICES = ( diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index 810b5ddca2..14130a7bae 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -82,7 +82,7 @@ class CourseMode(models.Model): # Modes that allow a student to earn credit with a university partner CREDIT_MODES = [CREDIT_MODE] - class Meta: + class Meta(object): """ meta attributes of this model """ unique_together = ('course_id', 'mode_slug', 'currency') diff --git a/common/djangoapps/django_comment_common/models.py b/common/djangoapps/django_comment_common/models.py index 6ea796da4b..6e739fc235 100644 --- a/common/djangoapps/django_comment_common/models.py +++ b/common/djangoapps/django_comment_common/models.py @@ -57,7 +57,7 @@ class Role(models.Model): users = models.ManyToManyField(User, related_name="roles") course_id = CourseKeyField(max_length=255, blank=True, db_index=True) - class Meta: + class Meta(object): # pylint: disable=missing-docstring # use existing table that was originally created from django_comment_client app db_table = 'django_comment_client_role' @@ -99,7 +99,7 @@ class Permission(models.Model): name = models.CharField(max_length=30, null=False, blank=False, primary_key=True) roles = models.ManyToManyField(Role, related_name="permissions") - class Meta: + class Meta(object): # pylint: disable=missing-docstring # use existing table that was originally created from django_comment_client app db_table = 'django_comment_client_permission' diff --git a/common/djangoapps/embargo/forms.py b/common/djangoapps/embargo/forms.py index 11632e4db8..2f29a664d0 100644 --- a/common/djangoapps/embargo/forms.py +++ b/common/djangoapps/embargo/forms.py @@ -25,7 +25,7 @@ class RestrictedCourseForm(forms.ModelForm): error message instead. """ - class Meta: # pylint: disable=missing-docstring + class Meta(object): # pylint: disable=missing-docstring model = RestrictedCourse def clean_course_key(self): @@ -58,7 +58,7 @@ class RestrictedCourseForm(forms.ModelForm): class IPFilterForm(forms.ModelForm): """Form validating entry of IP addresses""" - class Meta: # pylint: disable=missing-docstring + class Meta(object): # pylint: disable=missing-docstring model = IPFilter def _is_valid_ip(self, address): diff --git a/common/djangoapps/embargo/models.py b/common/djangoapps/embargo/models.py index 5c8192fdc5..eccd51dca1 100644 --- a/common/djangoapps/embargo/models.py +++ b/common/djangoapps/embargo/models.py @@ -379,7 +379,7 @@ class Country(models.Model): code=unicode(self.country) ) - class Meta: + class Meta(object): """Default ordering is ascending by country code """ ordering = ['country'] @@ -522,7 +522,7 @@ class CountryAccessRule(models.Model): cache.delete(cache_key) log.info("Invalidated country access list for course %s", course_key) - class Meta: + class Meta(object): """a course can be added with either black or white list. """ unique_together = ( # This restriction ensures that a country is on @@ -646,7 +646,7 @@ class CourseAccessRuleHistory(models.Model): else: CourseAccessRuleHistory.save_snapshot(restricted_course) - class Meta: # pylint: disable=missing-docstring,old-style-class + class Meta(object): # pylint: disable=missing-docstring get_latest_by = 'timestamp' diff --git a/common/djangoapps/external_auth/models.py b/common/djangoapps/external_auth/models.py index b40e427434..180f28bae1 100644 --- a/common/djangoapps/external_auth/models.py +++ b/common/djangoapps/external_auth/models.py @@ -14,7 +14,7 @@ from django.contrib.auth.models import User class ExternalAuthMap(models.Model): - class Meta: + class Meta(object): # pylint: disable=missing-docstring unique_together = (('external_id', 'external_domain'), ) external_id = models.CharField(max_length=255, db_index=True) external_domain = models.CharField(max_length=255, db_index=True) diff --git a/common/djangoapps/student/admin.py b/common/djangoapps/student/admin.py index 4bf11b1215..7f355da572 100644 --- a/common/djangoapps/student/admin.py +++ b/common/djangoapps/student/admin.py @@ -20,7 +20,7 @@ from opaque_keys import InvalidKeyError class CourseAccessRoleForm(forms.ModelForm): """Form for adding new Course Access Roles view the Django Admin Panel.""" - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = CourseAccessRole email = forms.EmailField(required=True) @@ -123,7 +123,7 @@ class CourseAccessRoleAdmin(admin.ModelAdmin): class LinkedInAddToProfileConfigurationAdmin(admin.ModelAdmin): """Admin interface for the LinkedIn Add to Profile configuration. """ - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = LinkedInAddToProfileConfiguration # Exclude deprecated fields diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 23abdd071c..c10a89c1a5 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -216,7 +216,7 @@ class UserProfile(models.Model): MITx fall prototype. """ - class Meta: # pylint: disable=missing-docstring + class Meta(object): # pylint: disable=missing-docstring db_table = "auth_userprofile" # CRITICAL TODO/SECURITY @@ -436,7 +436,7 @@ class Registration(models.Model): registration profile is created when the user creates an account, but that account is inactive. Once the user clicks on the activation key, it becomes active. ''' - class Meta: + class Meta(object): # pylint: disable=missing-docstring db_table = "auth_registration" user = models.ForeignKey(User, unique=True) @@ -846,7 +846,7 @@ class CourseEnrollment(models.Model): objects = CourseEnrollmentManager() - class Meta: + class Meta(object): # pylint: disable=missing-docstring unique_together = (('user', 'course_id'),) ordering = ('user', 'course_id') @@ -1407,7 +1407,7 @@ class CourseEnrollmentAllowed(models.Model): created = models.DateTimeField(auto_now_add=True, null=True, db_index=True) - class Meta: # pylint: disable=missing-docstring + class Meta(object): # pylint: disable=missing-docstring unique_together = (('email', 'course_id'),) def __unicode__(self): @@ -1444,7 +1444,7 @@ class CourseAccessRole(models.Model): course_id = CourseKeyField(max_length=255, db_index=True, blank=True) role = models.CharField(max_length=64, db_index=True) - class Meta: # pylint: disable=missing-docstring + class Meta(object): # pylint: disable=missing-docstring unique_together = ('user', 'org', 'course_id', 'role') @property @@ -1835,7 +1835,7 @@ class LanguageProficiency(models.Model): /edx-platform/openedx/core/djangoapps/user_api/accounts/views.py or its associated api method (update_account_settings) so that the events are emitted. """ - class Meta: + class Meta(object): # pylint: disable=missing-docstring unique_together = (('code', 'user_profile'),) user_profile = models.ForeignKey(UserProfile, db_index=True, related_name='language_proficiencies') diff --git a/common/djangoapps/track/backends/django.py b/common/djangoapps/track/backends/django.py index fe60cc4478..4fffc86d25 100644 --- a/common/djangoapps/track/backends/django.py +++ b/common/djangoapps/track/backends/django.py @@ -46,7 +46,7 @@ class TrackingLog(models.Model): time = models.DateTimeField('event time') host = models.CharField(max_length=64, blank=True) - class Meta: + class Meta(object): # pylint: disable=missing-docstring app_label = 'track' db_table = 'track_trackinglog' diff --git a/lms/djangoapps/ccx/models.py b/lms/djangoapps/ccx/models.py index 28aeae0fdd..9639923946 100644 --- a/lms/djangoapps/ccx/models.py +++ b/lms/djangoapps/ccx/models.py @@ -150,7 +150,7 @@ class CcxFieldOverride(models.Model): location = LocationKeyField(max_length=255, db_index=True) field = models.CharField(max_length=255) - class Meta: # pylint: disable=missing-docstring,old-style-class + class Meta(object): # pylint: disable=missing-docstring unique_together = (('ccx', 'location', 'field'),) value = models.TextField(default='null') diff --git a/lms/djangoapps/certificates/models.py b/lms/djangoapps/certificates/models.py index 1e83418fa7..ab105327c4 100644 --- a/lms/djangoapps/certificates/models.py +++ b/lms/djangoapps/certificates/models.py @@ -241,7 +241,7 @@ class ExampleCertificateSet(TimeStampedModel): """ course_key = CourseKeyField(max_length=255, db_index=True) - class Meta: # pylint: disable=missing-docstring, old-style-class + class Meta(object): # pylint: disable=missing-docstring get_latest_by = 'created' @classmethod @@ -498,7 +498,7 @@ class CertificateGenerationCourseSetting(TimeStampedModel): course_key = CourseKeyField(max_length=255, db_index=True) enabled = models.BooleanField(default=False) - class Meta: # pylint: disable=missing-docstring, old-style-class + class Meta(object): # pylint: disable=missing-docstring get_latest_by = 'created' @classmethod diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index 083cc602a9..15e54fc641 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -1163,7 +1163,7 @@ class InvoiceHistory(models.Model): elif hasattr(instance, 'invoice'): InvoiceHistory.save_invoice_snapshot(instance.invoice) - class Meta: # pylint: disable=missing-docstring,old-style-class + class Meta(object): # pylint: disable=missing-docstring get_latest_by = "timestamp" diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index 2196a5c773..32fb8b062a 100644 --- a/lms/djangoapps/verify_student/models.py +++ b/lms/djangoapps/verify_student/models.py @@ -895,7 +895,7 @@ class VerificationCheckpoint(models.Model): checkpoint_location = models.CharField(max_length=255) photo_verification = models.ManyToManyField(SoftwareSecurePhotoVerification) - class Meta: # pylint: disable=missing-docstring, old-style-class + class Meta(object): # pylint: disable=missing-docstring unique_together = ('course_id', 'checkpoint_location') def __unicode__(self): @@ -1089,7 +1089,7 @@ class SkippedReverification(models.Model): checkpoint = models.ForeignKey(VerificationCheckpoint, related_name="skipped_checkpoint") created_at = models.DateTimeField(auto_now_add=True) - class Meta: # pylint: disable=missing-docstring, old-style-class + class Meta(object): # pylint: disable=missing-docstring unique_together = (('user', 'course_id'),) @classmethod diff --git a/openedx/core/djangoapps/course_groups/models.py b/openedx/core/djangoapps/course_groups/models.py index 3fc6828bdc..ff80d96979 100644 --- a/openedx/core/djangoapps/course_groups/models.py +++ b/openedx/core/djangoapps/course_groups/models.py @@ -18,7 +18,7 @@ class CourseUserGroup(models.Model): which may be treated specially. For example, a user can be in at most one cohort per course, and cohorts are used to split up the forums by group. """ - class Meta: + class Meta(object): # pylint: disable=missing-docstring unique_together = (('name', 'course_id'), ) name = models.CharField(max_length=255, diff --git a/openedx/core/djangoapps/user_api/accounts/serializers.py b/openedx/core/djangoapps/user_api/accounts/serializers.py index 9cddc14274..dcca026227 100644 --- a/openedx/core/djangoapps/user_api/accounts/serializers.py +++ b/openedx/core/djangoapps/user_api/accounts/serializers.py @@ -15,7 +15,7 @@ class LanguageProficiencySerializer(serializers.ModelSerializer): Class that serializes the LanguageProficiency model for account information. """ - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = LanguageProficiency fields = ("code",) @@ -36,7 +36,7 @@ class AccountUserSerializer(serializers.HyperlinkedModelSerializer, ReadOnlyFiel """ Class that serializes the portion of User model needed for account information. """ - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = User fields = ("username", "email", "date_joined", "is_active") read_only_fields = ("username", "email", "date_joined", "is_active") @@ -51,7 +51,7 @@ class AccountLegacyProfileSerializer(serializers.HyperlinkedModelSerializer, Rea requires_parental_consent = serializers.SerializerMethodField("get_requires_parental_consent") language_proficiencies = LanguageProficiencySerializer(many=True, allow_add_remove=True, required=False) - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = UserProfile fields = ( "name", "gender", "goals", "year_of_birth", "level_of_education", "country", diff --git a/openedx/core/djangoapps/user_api/models.py b/openedx/core/djangoapps/user_api/models.py index 5a185de369..0fd22ac83d 100644 --- a/openedx/core/djangoapps/user_api/models.py +++ b/openedx/core/djangoapps/user_api/models.py @@ -24,7 +24,7 @@ class UserPreference(models.Model): key = models.CharField(max_length=255, db_index=True, validators=[RegexValidator(KEY_REGEX)]) value = models.TextField() - class Meta: # pylint: disable=missing-docstring + class Meta(object): # pylint: disable=missing-docstring unique_together = ("user", "key") @classmethod @@ -93,7 +93,7 @@ class UserCourseTag(models.Model): course_id = CourseKeyField(max_length=255, db_index=True) value = models.TextField() - class Meta: # pylint: disable=missing-docstring + class Meta(object): # pylint: disable=missing-docstring unique_together = ("user", "course_id", "key") @@ -108,6 +108,6 @@ class UserOrgTag(TimeStampedModel): org = models.CharField(max_length=255, db_index=True) value = models.TextField() - class Meta: + class Meta(object): """ Meta class for defining unique constraints. """ unique_together = ("user", "org", "key") diff --git a/openedx/core/djangoapps/user_api/serializers.py b/openedx/core/djangoapps/user_api/serializers.py index fefee20e53..e95dedee00 100644 --- a/openedx/core/djangoapps/user_api/serializers.py +++ b/openedx/core/djangoapps/user_api/serializers.py @@ -16,7 +16,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer): def get_preferences(self, user): return dict([(pref.key, pref.value) for pref in user.preferences.all()]) - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = User # This list is the minimal set required by the notification service fields = ("id", "url", "email", "name", "username", "preferences") @@ -26,7 +26,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer): class UserPreferenceSerializer(serializers.HyperlinkedModelSerializer): user = UserSerializer() - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = UserPreference depth = 1 @@ -36,7 +36,7 @@ class RawUserPreferenceSerializer(serializers.ModelSerializer): """ user = serializers.PrimaryKeyRelatedField() - class Meta: + class Meta(object): # pylint: disable=missing-docstring model = UserPreference depth = 1