Ejemplo n.º 1
0
                #image_path = 'View Thumbnails//' + user_wb.replace('/', ' ') + '_' + user_v.replace('/', ' ') + '.jpg'
                # mac
                image_path = 'View Thumbnails/' + user_wb.replace(
                    '/', ' ') + '_' + user_v.replace('/', ' ') + '.jpg'
                filename = os.path.join(fileDir, image_path)
                data = {
                    'name': user_wb + '_' + user_v + '.jpg',
                    'type': 'image/jpg',
                }
                with open(filename, 'rb') as img:
                    data['bits'] = xmlrpc_client.Binary(img.read())
                response = client.call(media.UploadFile(data))
                thumbnail_id = response['id']

                page.title = user_v
                page.parent_id = parentPages[category]
                if (category2):
                    cat = category2
                else:
                    cat = category

                page.excerpt = ''

                page.terms_names = {
                    'category': [cat],
                    'owner': [owner.fullname],
                }

                page.custom_fields = []
                page.custom_fields.append({
                    'key': 'dashboard_link',
Ejemplo n.º 2
0
    filename = '/Users/jgonzalez/Desktop/view_preview_images/' + ws.cell(
        row=i, column=1).value + '_' + ws.cell(row=i, column=4).value + '.jpg'
    data = {
        'name':
        ws.cell(row=i, column=1).value + '_' + ws.cell(row=i, column=4).value +
        '.jpg',
        'type':
        'image/jpg',
    }
    with open(filename, 'rb') as img:
        data['bits'] = xmlrpc_client.Binary(img.read())
    response = client.call(media.UploadFile(data))
    thumbnail_id = response['id']

    page.title = ws.cell(row=i, column=4).value
    page.parent_id = parentPages[ws.cell(row=i, column=2).value]
    cat = ws.cell(row=i, column=2).value

    #if there is a subcategory then make that the parent
    if ws.cell(row=i, column=3).value:
        page.parent_id = parentPages[ws.cell(row=i, column=3).value]
        cat = ws.cell(row=i, column=3).value

    #various taxonomies for page
    page.excerpt = ws.cell(row=i, column=5).value
    page.terms_names = {
        'category': [cat],
        'subject_type':
        ws.cell(row=i, column=7).value.splitlines(),
        'target_audience':
        ws.cell(row=i, column=8).value.splitlines(),