def pimp_file_exists(filename): lookup = get_lookup_class().objects.get_current() # lookup is not mandatory, maybe we do not have current item right now. if not lookup: return False if hasattr(settings, 'PIMPMYTHEME_FOLDER_NAME'): path = os.path.join(settings.PIMPMYTHEME_FOLDER_NAME, project_name, getattr(lookup, settings.CUSTOM_THEME_LOOKUP_ATTR), 'static', filename) else: path = os.path.join(getattr(lookup, settings.CUSTOM_THEME_LOOKUP_ATTR), 'static', filename) return not finders.find(path) is None
def pimp_exists(context, filetype, filename=None): if filename is None: filename = "" lookup = get_lookup_class().objects.get_current() # lookup is not mandatory, maybe we do not have current item right now. if not lookup: return paths = [] if hasattr(settings, 'PIMPMYTHEME_FOLDER_NAME'): paths = [settings.PIMPMYTHEME_FOLDER_NAME, project_name] paths.extend([getattr(lookup, settings.CUSTOM_THEME_LOOKUP_ATTR), "static", filetype, filename]) path = "/".join(paths) if finders.find(path) is None: return return pimp(context, filetype, filename)
def pimp(context, file_type, filename=None): if filename is None: filename = "" lookup = get_lookup_class().objects.get_current() # lookup is not mandatory, maybe we do not have current item right now. if not lookup: return '#' paths = [] if hasattr(settings, 'PIMPMYTHEME_FOLDER_NAME'): paths = [settings.PIMPMYTHEME_FOLDER_NAME, project_name] paths.extend([getattr(lookup, settings.CUSTOM_THEME_LOOKUP_ATTR), "static", file_type]) paths = filter(None, paths) # purging list from empty items url = "/".join(paths) url = static("".join([url, "/", filename])) return url
def pimp(context, file_type, filename=None): if filename is None: filename = "" lookup = get_lookup_class().objects.get_current(context=context) # lookup is not mandatory, maybe we do not have current item right now. if not lookup: return '#' paths = [] if hasattr(settings, 'PIMPMYTHEME_FOLDER_NAME'): paths = [settings.PIMPMYTHEME_FOLDER_NAME, project_name] paths.extend([ getattr(lookup, settings.CUSTOM_THEME_LOOKUP_ATTR), "static", file_type ]) paths = filter(None, paths) # purging list from empty items url = "/".join(paths) url = static("".join([url, "/", filename])) return url
def pimp_exists(context, filetype, filename=None): if filename is None: filename = "" # add the possibility to add a request on the get_current # in order to determine which is the current_site. # Multi-tenancy related #27 lookup = get_lookup_class().objects.get_current( context=context ) # lookup is not mandatory, maybe we do not have current item right now. if not lookup: return paths = [] if hasattr(settings, 'PIMPMYTHEME_FOLDER_NAME'): paths = [settings.PIMPMYTHEME_FOLDER_NAME, project_name] paths.extend([getattr(lookup, settings.CUSTOM_THEME_LOOKUP_ATTR), "static", filetype, filename]) path = "/".join(paths) if finders.find(path) is None: return return pimp(context, filetype, filename)
def pimp_exists(context, filetype, filename=None): if filename is None: filename = "" # add the possibility to add a request on the get_current # in order to determine which is the current_site. # Multi-tenancy related #27 lookup = get_lookup_class().objects.get_current(context=context) # lookup is not mandatory, maybe we do not have current item right now. if not lookup: return paths = [] if hasattr(settings, 'PIMPMYTHEME_FOLDER_NAME'): paths = [settings.PIMPMYTHEME_FOLDER_NAME, project_name] paths.extend([ getattr(lookup, settings.CUSTOM_THEME_LOOKUP_ATTR), "static", filetype, filename ]) path = "/".join(paths) if finders.find(path) is None: return return pimp(context, filetype, filename)
def handle(self, *args, **options): objects = get_lookup_class().objects.all() for elem in objects: create_folders(elem) call_command('collectstatic', interactive=False)