# HG changeset patch # User verrierj # Date 1314966394 -7200 # Node ID fe00e7302efe1db4f9b455fb305ed7d0b27ffb00 # Parent 790231e803ebfa4893f57cdc66931a862751c0f9 Change class and functions names to follow PEP8 formatting standards diff -r 790231e803eb -r fe00e7302efe src/ldt/ldt/auth/__init__.py --- a/src/ldt/ldt/auth/__init__.py Fri Sep 02 11:55:46 2011 +0200 +++ b/src/ldt/ldt/auth/__init__.py Fri Sep 02 14:26:34 2011 +0200 @@ -1,6 +1,6 @@ -def checkAccess(user, obj): - check_meth = getattr(obj, 'checkAccess', False) +def check_access(user, obj): + check_meth = getattr(obj, 'check_access', False) if check_meth: return check_meth(user) else: diff -r 790231e803eb -r fe00e7302efe src/ldt/ldt/ldt_utils/admin.py --- a/src/ldt/ldt/ldt_utils/admin.py Fri Sep 02 11:55:46 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/admin.py Fri Sep 02 14:26:34 2011 +0200 @@ -23,7 +23,7 @@ # fi = None fi = FileImport(filetoprocess, videoPath, flatten) try: - fi.processFile() + fi.process_file() args = {'message': "File imported"} except FileImportError: non_field_errors = form.non_field_errors() diff -r 790231e803eb -r fe00e7302efe src/ldt/ldt/ldt_utils/fileimport.py --- a/src/ldt/ldt/ldt_utils/fileimport.py Fri Sep 02 11:55:46 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/fileimport.py Fri Sep 02 14:26:34 2011 +0200 @@ -45,7 +45,7 @@ - def processIri(self): + def process_iri(self): # for just import a file ldt and get the title for every media if 'http' in self.src: #url = urllib.urlopen(self.src) @@ -138,7 +138,7 @@ @transaction.commit_on_success - def saveContent(self): + def save_content(self): defaults_media = { @@ -173,8 +173,8 @@ self.content = content def process(self): - self.processIri() - self.saveContent() + self.process_iri() + self.save_content() class BaseFileImport(object): @@ -238,24 +238,24 @@ def __init__(self, filepath, videopath, flatten): BaseFileImport.__init__(self, filepath, videopath) - self.__checkExistingMedia = False + self.__check_existing_media = False self.__flatten = flatten - def checkExistingMedia(): #@NoSelf + def check_existing_media(): #@NoSelf doc = """Docstring""" #@UnusedVariable def fget(self): - return self.__checkExistingMedia + return self.__check_existing_media def fset(self, value): - self.__checkExistingMedia = value + self.__check_existing_media = value def fdel(self): - del self.__checkExistingMedia + del self.__check_existing_media return locals() - checkExistingMedia = property(**checkExistingMedia()) + check_existing_media = property(**check_existing_media()) def flatten(): #@NoSelf doc = """Docstring""" #@UnusedVariable @@ -272,7 +272,7 @@ return locals() flatten = property(**flatten()) - def processLdt(self, ldtpath=None): + def process_ldt(self, ldtpath=None): # list iri # see if there is some comments @@ -306,7 +306,7 @@ # get iri file's id from file ldt #id = medianode.attributes['id'].value id = medianode.attrib['id'] - if self.checkExistingMedia: + if self.check_existing_media: try: Content.objects.get(iri_id=id) do_pass = True @@ -352,17 +352,17 @@ # move iri file to the proper place #return list of iriInfo - def processFile(self): + def process_file(self): if self.filepath.name.endswith(".ldt"): - self.processLdt() + self.process_ldt() elif self.filepath.name.endswith(".zip"): - self.processZip() + self.process_zip() else: raise FileImportError("Bad file type") - def processZip(self): - # """ extraire .zip, pass to method processLdt""" + def process_zip(self): + # """ extraire .zip, pass to method process_ldt""" # create temp directory self.__tempdir = tempfile.mkdtemp() openfiles = [] @@ -383,7 +383,7 @@ if(os.path.isdir(entryPath)): foldersToProcess.append(entryPath) elif fnmatch.fnmatch(entry, "*.ldt"): - ldtid = self.processLdt(entryPath) + ldtid = self.process_ldt(entryPath) processedids.append(ldtid) elif fnmatch.fnmatch(entry, "*.flv"): flvfiles.append(entryPath) @@ -399,8 +399,8 @@ # delete directory return processedids - # def processFileLdt(self): + # def process_file_ldt(self): # processedids = [] - # ldtid = self.processLdt(self.filepath) + # ldtid = self.process_ldt(self.filepath) # processedids.append(ldtid) # return processedids diff -r 790231e803eb -r fe00e7302efe src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Fri Sep 02 11:55:46 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/models.py Fri Sep 02 14:26:34 2011 +0200 @@ -376,7 +376,7 @@ project.save() return project - def checkAccess(self, user): + def check_access(self, user): if (user and user.is_staff) or self.state == 2: return True else: diff -r 790231e803eb -r fe00e7302efe src/ldt/ldt/ldt_utils/projectserializer.py --- a/src/ldt/ldt/ldt_utils/projectserializer.py Fri Sep 02 11:55:46 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/projectserializer.py Fri Sep 02 14:26:34 2011 +0200 @@ -399,7 +399,7 @@ return res - def getAnnotations(self, first_cutting=True): + def get_annotations(self, first_cutting=True): if not self.parsed: self.__parse_ldt() diff -r 790231e803eb -r fe00e7302efe src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Fri Sep 02 11:55:46 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Fri Sep 02 14:26:34 2011 +0200 @@ -42,7 +42,7 @@ '{% trans "File uploaded" %}', '{% trans "Please wait, the upload is not finished yet" %}', '{% trans "Cancel upload" %}', - "{% url ldt.ldt_utils.views.removetempfile %}", + "{% url ldt.ldt_utils.views.remove_temp_file %}", "{% url ldt.ldt_utils.views.get_duration %}"); }); diff -r 790231e803eb -r fe00e7302efe src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Fri Sep 02 11:55:46 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Fri Sep 02 14:26:34 2011 +0200 @@ -6,8 +6,8 @@ {{block.super}}