示例#1
0
def archive_files(community, files, path):
    folder = ArchiveFolder()
    contents = []
    for name, file in files.items():
        if ICommunityFolder.providedBy(file):
            folder[name] = archive_files(community, file, path + (name,))
            contents.append({
                'type': 'folder',
                'title': file.title + ' /',
                'url': file.__name__ + '/index.html',
            })
        else:
            folder[name] = file.blobfile
            contents.append({
                'type': 'file',
                'title': file.title,
                'url': file.__name__,
                'author': get_author(file),
                'date': str(file.created)
            })

    folder['index.html'] = ArchiveTemplate(
        'templates/archive_files.pt',
        community=community,
        title=files.title,
        path=path,
        contents=contents,
    )
    return folder
示例#2
0
文件: archive.py 项目: araymund/karl
def archive_files(community, files, path):
    folder = ArchiveFolder()
    contents = []
    for name, file in files.items():
        if ICommunityFolder.providedBy(file):
            folder[name] = archive_files(community, file, path + (name, ))
            contents.append({
                'type': 'folder',
                'title': file.title + ' /',
                'url': file.__name__ + '/index.html',
            })
        else:
            folder[name] = file.blobfile
            contents.append({
                'type': 'file',
                'title': file.title,
                'url': file.__name__,
                'author': get_author(file),
                'date': str(file.created)
            })

    folder['index.html'] = ArchiveTemplate(
        'templates/archive_files.pt',
        community=community,
        title=files.title,
        path=path,
        contents=contents,
    )
    return folder
示例#3
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        in_intranets = find_interface(context, IIntranets) is not None
        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder and in_intranets

        title = getattr(context, 'title', context.__name__)
        self.page_title = 'Advanced Settings for %s' % title
示例#4
0
文件: advanced.py 项目: lslaz1/karl
    def __init__(self, context, request):
        self.context = context
        self.request = request

        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder

        self.use_unlock = lock.is_locked(context)

        title = getattr(context, "title", context.__name__)
        self.page_title = "Advanced Settings for %s" % title
示例#5
0
文件: advanced.py 项目: lslaz1/karl
    def __init__(self, context, request):
        self.context = context
        self.request = request

        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder

        self.use_unlock = lock.is_locked(context)

        title = getattr(context, 'title', context.__name__)
        self.page_title = 'Advanced Settings for %s' % title
示例#6
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        in_intranets = find_interface(context, IIntranets) is not None
        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder and in_intranets

        self.use_unlock = lock.is_locked(context)

        title = getattr(context, 'title', context.__name__)
        self.page_title = 'Advanced Settings for %s' % title
示例#7
0
文件: adapters.py 项目: iotest3/new
 def __init__(self, context, request):
     assert ICommunityFolder.providedBy(context)
     self.context = context
     self.request = request