From 2362bc800a533f118d42f2668c6e49c1bf9449c6 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 9 Jun 2011 18:39:29 +0530 Subject: [PATCH] Changed classname of jstimestamp and added disallowed list --- cgi-bin/webnotes/utils/jstimestamp.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/cgi-bin/webnotes/utils/jstimestamp.py b/cgi-bin/webnotes/utils/jstimestamp.py index d6efab7d31..78e9247ee2 100644 --- a/cgi-bin/webnotes/utils/jstimestamp.py +++ b/cgi-bin/webnotes/utils/jstimestamp.py @@ -1,16 +1,30 @@ -class generate_timestamp: +class generateTimestamp: def list_js_files(self,jsdir,ext='js'): import os all_files= [] + nono = ['./tiny_mce','./jquery'] oldcwd = os.getcwd() os.chdir(jsdir) for root, subfolders, files in os.walk('.'): - for filename in files: - if filename.endswith(ext): - all_files.append(os.path.join(root,filename)) + if self.is_allowed(nono,root): + for filename in files: + if filename.endswith(ext): + all_files.append(os.path.join(root,filename)) + os.chdir(oldcwd) + for i in nono: + for j in all_files: + if j.startswith(i): + all_files.remove(j) return all_files + def is_allowed(self,disallowed,item): + for i in disallowed: + if item.startswith(i): + return False + return True + + def get_timestamp_dict(self,jsdir,filelist): tsdict={} import os