Example #1
0
def upload(utype, title, categories, tags, content):
  logging.info("uploading post \"%s\"" % title)

  if utype == UploadType.POST:
    p = posts.WordPressPost()
  else:
    p = WordPressPage()

  p.title = title
  p.content = content
  p.post_status = 'publish'

  if utype == UploadType.POST:
    p.terms_names = {
      'post_tag': tags,
      'category': categories
    }

  wp_client.call(posts.NewPost(p))
                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',
                    'value': ''
                })
                page.custom_fields.append({
                    'key': 'dashboard_tips',
                    'value': ''
                })
                page.custom_fields.append({'key': 'context', 'value': ''})
                page.custom_fields.append({
                    'key':
                    'dashboard_link',
Example #3
0
    #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(),
        'user_access':
        getAccessLevel(ws.cell(row=i, column=9).value),
        'owner': [ws.cell(row=i, column=6).value],
        'update_freq': [ws.cell(row=i, column=10).value],
        'extra_icons':
        getExtraIcons(
            ws.cell(row=i, column=11).value,
            ws.cell(row=i, column=12).value)
    }

    #custom fields for page
    page.custom_fields = []
    page.custom_fields.append({
        'key': 'dashboard_link',
        'value': ws.cell(row=i, column=16).value
    })
    page.custom_fields.append({