Пример #1
0
def macro_Color2(macro, text=None, col=None, bcol=None, font=None):
    f = macro.formatter

    if not text:
        return f.strong(1) + \
               f.text('Color2 examples : ') + \
               f.text('<<Color2(Hello World!,red,blue,18px courier)>>, ') + \
               f.text('<<Color2(Hello World!,col=red,bcol=blue,font=18px courier)>>, ') + \
               f.text('<<Color2(Hello World!,#8844AA)>>') + \
               f.strong(0) + f.linebreak(0)

    style = ''
    if col:
        style += 'color:%s; '            % col
    if bcol:
        style += 'background-color:%s; ' % bcol
    if font:
        style += 'font:%s; '             % font

    # Escape HTML stuff.
    text = wikiutil.escape(text)
    text = wikiutil.renderText(macro.request, WikiParser, text)
    text = text.strip()

    return f.rawHTML('<span style="%s">' % style) + text + f.rawHTML('</span>')
Пример #2
0
    def format(self, formatter):
        # print "format"
        # format is also called for each !# command. its called after __init__
        # is called. this is where parsers do most of their work.
        # they write their results into the Httprequest object
        # which is usually stored from __init__ in self.request.

        # print "formatter",dir(formatter)
        # formatter is a special object in MoinMoin that
        # is supposed to help people who write extensions to have
        # sort of a uniform looking thing going on.
        # see http://moinmoin.wikiwikiweb.de/ApplyingFormatters?highlight=%28formatter%29

        # but formatter is not documented well. you have to look at
        # moinmoin/formatter/base.py. And if you do, you will see that half of
        # the methods raise a 'not implemented' error.
        # formatter is also being refactored alot so dont get used to it.
        # if all else fails just use formatter.rawHTML which will
        # screw up XML output but at least it will work.

        page_name = formatter.page.page_name
        cs_template_page = wikiutil.AbsPageName(page_name,
                                                self.kw["format_args"])
        cs_template = Page(self.request, cs_template_page).getPageText()

        hdf = neo_util.HDF()
        hdf.readString(self.raw)
        hdf.setValue("Config.WhiteSpaceStrip", "0")

        cs = neo_cs.CS(hdf)
        cs.parseStr(cs_template)
        body = cs.render()
        body = wikiutil.renderText(self.request, WikiParser, body)
        self.request.write(formatter.rawHTML(body))
Пример #3
0
    def format(self, formatter):
        # print "format"
        # format is also called for each !# command. its called after __init__
        # is called. this is where parsers do most of their work.
        # they write their results into the Httprequest object
        # which is usually stored from __init__ in self.request.

        # print "formatter",dir(formatter)
        # formatter is a special object in MoinMoin that
        # is supposed to help people who write extensions to have
        # sort of a uniform looking thing going on.
        # see http://moinmoin.wikiwikiweb.de/ApplyingFormatters?highlight=%28formatter%29

        # but formatter is not documented well. you have to look at
        # moinmoin/formatter/base.py. And if you do, you will see that half of
        # the methods raise a 'not implemented' error.
        # formatter is also being refactored alot so dont get used to it.
        # if all else fails just use formatter.rawHTML which will
        # screw up XML output but at least it will work.

        page_name = formatter.page.page_name
        cs_template_page = wikiutil.AbsPageName(page_name, self.kw["format_args"])
        cs_template = Page(self.request, cs_template_page).getPageText()

        hdf = neo_util.HDF()
        hdf.readString(self.raw)
        hdf.setValue("Config.WhiteSpaceStrip", "0")

        cs = neo_cs.CS(hdf)
        cs.parseStr(cs_template)
        body = cs.render()
        body = wikiutil.renderText(self.request, WikiParser, body)
        self.request.write(formatter.rawHTML(body))
Пример #4
0
def execute(macro, args):
    request = macro.request
    content = []
    page_name = macro.formatter.page.page_name

    # get args
    include_page_name = ''
    if args is not None:
        (include_page_name, _, hdf_text) = args.partition(',')

    include_page_name = wikiutil.AbsPageName(page_name, include_page_name)

    include_page = Page(request, include_page_name)

    if include_page is None:
        return ''
    if not request.user.may.read(include_page_name):
        return ''

    cstemplate = include_page.getPageText()

    pagename = macro.formatter.page.page_name

    hdf = neo_util.HDF()
    hdf.readString(hdf_text)

    hdf.setValue("Config.WhiteSpaceStrip ", "0")

    cs = neo_cs.CS(hdf)
    cs.parseStr(cstemplate)

    body = cs.render()

    body = wikiutil.renderText(request, WikiParser, body)
    return body
Пример #5
0
def execute(macro, first_tutorial):
    try:
        request = macro.request
        _ = request.getText

        if type(first_tutorial) == str:
            first_tutorial = first_tutorial.strip()
        if not first_tutorial:
            err = _('Invalid first Tutorial given: '
                    '{{{"%s"}}}', wiki=True) % first_tutorial
            return '<span class="error">%s</span>' % err

        tutorial_list = crawl_tutorials_breadth_first(first_tutorial, macro)

        f = macro.formatter
        content = ''
        content += f.number_list(1)
        for link, title, desc in tutorial_list:
            desc = str(desc or 'No Description')
            content += ''.join([
                f.listitem(1),
                f.pagelink(1, str(link or '#BadLink')),
                str(title or 'No Title'),
                f.pagelink(0), "<p>",
                wikiutil.renderText(request, WikiParser, desc), "</p>",
                f.listitem(0)
            ])
        content += f.number_list(0)
        return content
    except Exception as e:
        import traceback
        tb = traceback.format_exc()
        return '<span class="error"><pre>%s\nError: %s</pre></span>' % (tb, e)
Пример #6
0
def _format(src_text, request):
    """Parse the text (in wiki source format) and make HTML, after
    diverting sys.stdout to a string"""

    Parser = wikiutil.searchAndImportPlugin(request.cfg, "parser",
                                            request.page.pi['format'])
    return wikiutil.renderText(request, Parser, src_text).strip()
Пример #7
0
def execute(macro, first_tutorial):
    try:
        request = macro.request
        _ = request.getText

        if type(first_tutorial) == str:
            first_tutorial = first_tutorial.strip()
        if not first_tutorial:
            err = _('Invalid first Tutorial given: '
                    '{{{"%s"}}}', wiki=True) % first_tutorial
            return '<span class="error">%s</span>' % err

        tutorial_list = crawl_tutorials_breadth_first(first_tutorial, macro)

        f = macro.formatter
        content = ''
        content += f.number_list(1)
        for link, title, desc in tutorial_list:
            desc = str(desc or 'No Description')
            content += ''.join([
                f.listitem(1),
                f.pagelink(1, str(link or '#BadLink')),
                str(title or 'No Title'),
                f.pagelink(0),
                "<p>",
                wikiutil.renderText(request, WikiParser, desc),
                "</p>",
                f.listitem(0)
            ])
        content += f.number_list(0)
        return content
    except Exception as e:
        import traceback
        tb = traceback.format_exc()
        return '<span class="error"><pre>%s\nError: %s</pre></span>' % (tb, e)
Пример #8
0
Файл: CS.py Проект: 130s/roswiki
def execute(macro, args):
    request = macro.request
    content = []
    page_name = macro.formatter.page.page_name

    # get args
    include_page_name = ''
    if args is not None:
        (include_page_name, _, hdf_text) = args.partition(',')

    include_page_name = wikiutil.AbsPageName(page_name, include_page_name)

    include_page = Page(request, include_page_name)

    if include_page is None:
        return ''
    if not request.user.may.read(include_page_name):
        return ''
      
    cstemplate = include_page.getPageText()

    pagename = macro.formatter.page.page_name
    
    hdf = neo_util.HDF()
    hdf.readString(hdf_text)

    hdf.setValue("Config.WhiteSpaceStrip ", "0")

    cs = neo_cs.CS(hdf)
    cs.parseStr(cstemplate)

    body = cs.render()

    body = wikiutil.renderText(request, WikiParser, body)
    return body
Пример #9
0
def find_by_re (request, formatter, re_exp, rpl_text, search):

    ret = []

    if not hasattr(request, "_Include_backto"):
        request._Include_backto = formatter.page.page_name

    if search == None:
        pages = getPageListFromLog(request)
        ret.append('Results from recent-log(%d pages):' % len(pages))
    else:
        pages = getPageListFromSearch(request,search)
        ret.append('Results from searching by __%s__(%d pages):' % (search, len(pages)))

    task_re = re.compile(re_exp, re.UNICODE|re.DOTALL)

    for pagename in pages:

        if pagename == formatter.page.page_name: continue

        page = Page(request, pagename)
        if not page.exists(): continue

        ret.append(findtext_by_re(request, task_re, re_exp, rpl_text, page))

    return wikiutil.renderText(request, WikiParser, '\n'.join(ret))#wikiutil.escape('\n'.join(ret)))
def execute( macro, url ):
    request = macro.request
    try:
        text = urllib.urlopen( url ).read()
    except IOError:
        text = "{{{ IncludeUrl failed on " + url + " }}}"
    text = unicode(text,encoding='utf-8',errors='replace')
    return wikiutil.renderText(request, WikiParser, text)
Пример #11
0
def emit_footnotes(request, formatter):
    # emit collected footnotes
    if request.footnotes:
        result = []

        result.append(formatter.div(1, css_class='footnotes'))

        # Add footnotes list
        result.append(formatter.number_list(1))
        subidx = 0
        for ctr in range(request.footnote_ctr):
            fn_txt = request.footnotes[ctr]
            if not fn_txt in request.footnotes:
                continue
            this_txt_footnotes, fwdlink_id, showidx = request.footnotes[fn_txt]
            # this text was handled
            del request.footnotes[fn_txt]

            result.append(formatter.listitem(1))
            result.append(formatter.paragraph(1))
            result.append(formatter.anchorlink(1, None, id=fwdlink_id))
            result.append(formatter.anchorlink(0))
            result.append(wikiutil.renderText(request, WikiParser, fn_txt))

            items = []
            # ToDo check why that loop is needed?
            for backlink_id, idx in this_txt_footnotes:
                # Add item
                item = formatter.anchorlink(1, backlink_id)
                item += formatter.text(str(subidx + 1))
                item += formatter.anchorlink(0)
                items.append(item)
                subidx += 1

            result.append(formatter.text(" ("))
            result.append(formatter.text(" ").join(items))
            result.append(formatter.text(")"))

            result.append(formatter.paragraph(0))
            result.append(formatter.listitem(0))

        result.append(formatter.number_list(0))

        # Finish div
        result.append(formatter.div(0))

        del request.footnotes
        del request.footnote_ctr
        del request.footnote_show_ctr
        return ''.join(result)

    return ''
def emit_footnotes(request, formatter):
    # emit collected footnotes
    if request.footnotes:
        result = []

        result.append(formatter.div(1, css_class='footnotes'))

        # Add footnotes list
        result.append(formatter.number_list(1))
        subidx = 0
        for ctr in range(request.footnote_ctr):
            fn_txt = request.footnotes[ctr]
            if not fn_txt in request.footnotes:
                continue
            this_txt_footnotes, fwdlink_id, showidx = request.footnotes[fn_txt]
            # this text was handled
            del request.footnotes[fn_txt]

            result.append(formatter.listitem(1))
            result.append(formatter.paragraph(1))
            result.append(formatter.anchorlink(1, None, id=fwdlink_id))
            result.append(formatter.anchorlink(0))
            result.append(wikiutil.renderText(request, WikiParser, fn_txt))

            items = []
            # ToDo check why that loop is needed?
            for backlink_id, idx in this_txt_footnotes:
                # Add item
                item = formatter.anchorlink(1, backlink_id)
                item += formatter.text(str(subidx+1))
                item += formatter.anchorlink(0)
                items.append(item)
                subidx += 1

            result.append(formatter.text(" ("))
            result.append(formatter.text(" ").join(items))
            result.append(formatter.text(")"))

            result.append(formatter.paragraph(0))
            result.append(formatter.listitem(0))

        result.append(formatter.number_list(0))

        # Finish div
        result.append(formatter.div(0))

        del request.footnotes
        del request.footnote_ctr
        del request.footnote_show_ctr
        return ''.join(result)

    return ''
Пример #13
0
def execute(macro, args):
    request = macro.request
    content = []
    page_name = macro.formatter.page.page_name

    # get args
    include_page_name = ''
    if args is not None:
        include_page_name = args

    include_page_name = wikiutil.AbsPageName(page_name, include_page_name)

    include_page = Page(request, include_page_name)

    if include_page is None:
        return ''
    if not request.user.may.read(include_page_name):
        return ''

    cstemplate = include_page.getPageText()

    pagename = macro.formatter.page.page_name
    kv_page = Page(request, pagename)
    kv_body = kv_page.get_body()

    hdf = neo_util.HDF()
    for line in kv_body.split("\n"):
        if line.startswith("##"):
            line = line[2:].strip()
            parts = line.split("=", 1)
            if len(parts) == 2:
                val = parts[1].strip()
                #val = parts[1].strip().encode('utf-8')  # swh
                hdf.setValue(parts[0].strip(), val)

    hdf.setValue("Config.WhiteSpaceStrip ", "0")

    cs = neo_cs.CS(hdf)
    cs.parseStr(cstemplate)

    body = cs.render()

    body = wikiutil.renderText(request, WikiParser, body)

    open("/tmp/out.html", "w").write(body)

    return body
Пример #14
0
def execute(macro, args):
    request = macro.request
    content = []
    page_name = macro.formatter.page.page_name

    # get args
    include_page_name = ''
    if args is not None:
        include_page_name = args

    include_page_name = wikiutil.AbsPageName(page_name, include_page_name)

    include_page = Page(request, include_page_name)

    if include_page is None:
        return ''
    if not request.user.may.read(include_page_name):
        return ''
      
    cstemplate = include_page.getPageText()

    pagename = macro.formatter.page.page_name
    kv_page = Page(request, pagename)
    kv_body = kv_page.get_body()
    
    hdf = neo_util.HDF()
    for line in kv_body.split("\n"):
      if line.startswith("##"):
        line = line[2:].strip()
        parts = line.split("=", 1)
        if len(parts) == 2:
          val = parts[1].strip()
          #val = parts[1].strip().encode('utf-8')  # swh
          hdf.setValue(parts[0].strip(), val)

    hdf.setValue("Config.WhiteSpaceStrip ", "0")

    cs = neo_cs.CS(hdf)
    cs.parseStr(cstemplate)

    body = cs.render()

    body = wikiutil.renderText(request, WikiParser, body)

    open("/tmp/out.html", "w").write(body)

    return body
Пример #15
0
def execute(macro, args):
    request = macro.request
    content = []
    page_name = macro.formatter.page.page_name

    # get args
    include_page_name = ''
    if args is not None:
        include_page_name = args

    include_page_name = wikiutil.AbsPageName(page_name, include_page_name)

    include_page = Page(request, include_page_name)

    if include_page is None:
        return ''
    if not request.user.may.read(include_page_name):
        return ''
    else:
        return wikiutil.renderText(request, WikiParser, include_page.getPageText())
Пример #16
0
def getPageListFromLog (macro, req_year, req_week_number,comments_only):
    request = macro.request
    pages = {}
    oldyw = -1
    passed= False

    for line in editlog.EditLog(request).reverse():

        if not request.user.may.read(line.pagename):
            continue

        line.time_tuple = request.user.getTime(wikiutil.version2timestamp(line.ed_time_usecs))
        year,wn,wd = datetime.isocalendar(datetime.fromtimestamp(time.mktime(line.time_tuple)))
        yw = '%04d%02d' % (year,wn)

        if req_year > 0 and req_week_number > 0:
            if req_week_number == wn and req_year == year:
                passed = True
            elif passed and ((req_week_number < wn and req_year == year) or req_year < year):
                break #for a performance
            else:
                continue

        if not pages.has_key(yw):
            pages[yw] = {}

        if pages[yw].has_key(line.pagename):
            pages[yw][line.pagename].append(line.comment)
        else:
            pages[yw][line.pagename] = [line.comment]


    ret = []
    for yw in reversed(sorted(pages.keys())):
        if len(pages[yw].keys()) > 0:
            ret.append("WEEK%s, %s" % (yw[-2:], yw[:4]))
            for page in reversed(sorted(pages[yw].keys(), key=lambda x:len(pages[yw][x]))):
                edit_cnt = len(pages[yw][page])
                comments = filter(lambda x:len(x)>0, pages[yw][page])


                p = Page(request, page)

                if len(comments)>0 or not comments_only:
                    if p.exists():
                        ret.append(' * [[%s]] (%s)' % (page, str(edit_cnt)))
                    else:
                        ret.append(' * `%s` (%s)' % (page, str(edit_cnt)))
                    for comment in comments:
                        ret.append('  * ' + comment)
            """
            ret.append('<b>WEEK%s, %s</b>'% (yw[-2:],yw[:4]))
            ret.append('<ol>')
            for page in reversed(sorted(pages[yw].keys(), key=lambda x:len(pages[yw][x]))):
                page_link = Page(request,page).link_to(request, '%s(%d) ' % (page,len(pages[yw][page]),), css_class="include-page-link")
                comments = filter(lambda x:len(x)>0, pages[yw][page])
                if comments_only and len(comments)>0:
                    ret.append('<li>'+page_link+'</li>')
                    ret.append('<ul>')
                    for comment in comments:
                        ret.append('<li>' + comment + '</li>')
                    ret.append('</ul>')
                elif not comments_only:
                    ret.append('<li>'+page_link+'</li>')
                    ret.append('<ul>')
                    for comment in comments:
                        ret.append('<li>' + comment + '</li>')
                    ret.append('</ul>')
            ret.append('</ol>')
            """

    macro_str = "<<%s(%s)>>" % (macro.name, macro.args)
    content_str = '\n'.join(ret)
    form = u'''<form method='post'>
    <input type='hidden' name='action' value='ReplaceTagAction'>
    <input type='hidden' name='rsv' value='0'>
    <input type='hidden' name='regexp' value='0'>
    <textarea name='tag' style='display:none'>%s</textarea>
    <textarea name='txt' style='display:none'>%s</textarea>
    <input type='submit' value='   HARDCOPY TO THIS PAGE   '>
</form>
''' % (macro_str, content_str)
    return wikiutil.renderText(request, WikiParser, wikiutil.escape(content_str)) + form
Пример #17
0
	def handle_request(self):
		wiki_page_base = Page(self.request, _wiki_base)
		wiki_page_config = Page(self.request, _wiki_base+'/Config')
		form = self.request.form
		
		#=== Sanity checks: Create required pages if not exist, check if oauth config works ===
		
		#create _wiki_base page, if not exists
		if not Page(self.request, _wiki_base).exists():
			try:
				self.create_default_wikibase_page()
			except Exception as e:
				self.request.theme.add_msg('Could not create page "'+_wiki_base+'": '+pformat(e), 'error')
				Page(self.request, self.pagename).send_page()
				return
		#create Template page, if not exists
		if not Page(self.request, _wiki_base+'/Template').exists():
			try:
				self.create_default_wikitemplate_page()
			except Exception as e:
				self.request.theme.add_msg('Could not create page "'+_wiki_base+'/Template'+'": '+pformat(e), 'error')
				Page(self.request, self.pagename).send_page()
				return
		if wiki_page_config.exists():
			#parse config page and put as dict into self.config
			self.read_config(wiki_page_config)
		else:
			#create Log page, if not exists
			try:
				if not Page(self.request, _wiki_base+'/Log').exists():
					self.create_default_wikilog_page()
			except Exception as e:
				self.request.theme.add_msg('Could not create page "'+_wiki_base+'/Log": '+pformat(e), 'error')
				Page(self.request, self.pagename).send_page()
				return
			#create Config page, if not exists
			try:
				self.create_default_config_page()
			except Exception as e:
				self.request.theme.add_msg('Could not create page "'+_wiki_base+'/Config'+'": '+pformat(e), 'error')
				Page(self.request, self.pagename).send_page()
				return
			
			self.request.theme.add_msg('Welcome to Mendeley2Moin. Pages needed for this plugin have been created.', 'info')
			Page(self.request, _wiki_base+'/Log').send_page()
			return
		
		#Create MendeleyImporter instance and try to login using consumer/secret key and the file with authenticated tokens
		self.mendeley_importer = MendeleyImporter(self.config['consumer_key'], self.config['secret_key'])
		#Check if the user submitted the OAuth verifier
		if self.request.values.has_key('submitVerifier'):
			#parse serialized token and verifier
			try:
				self.mendeley_importer.set_verified_token(self.request.values['token'], self.request.values['verifier'])
			except ValueError as e:
				self.request.theme.add_msg('Could not authenticate tokens: '+pformat(e), 'error')
				Page(self.request, _wiki_base+'/Log').send_page()
				return
			#save tokens as pickled file as attachment to Config page
			self.mendeley_importer.save_keys(AttachFile.getAttachDir(self.request, _wiki_base+'/Config'))
			self.prepend_to_wiki_page(_wiki_base+'/Log', 'OAuth configuration completed', \
				'Access tokens have been saved [[attachment:%s/Config/mendeley_api_keys.pkl | here]]. Click here to run the plugin: [[/|Mendeley2Moin|&action=Mendeley2Moin]]\n'+\
				'\n(Or go to Mendeley2Moin overview page.)\n' % (_wiki_base))
			self.request.theme.add_msg('Tokens verified.' % (wikiutil.escape(self.mendeley_importer.mendeley.request_token)), 'info')
			Page(self.request, _wiki_base+'/Log').send_page()
			return
		#Try to read file with authenticated tokens. They are supposed to be an attachment of the Config page
		attachment = u'mendeley_api_keys.pkl'
		if not AttachFile.exists(self.request, _wiki_base+'/Config', attachment):
			#If file with authenticated tokens does not exist, request URL and write it as Log message to the user
			try:
				auth_url = self.mendeley_importer.get_auth_url()
			except Exception as e:
				self.request.theme.add_msg('Could not request OAuth URL: '+pformat(e), 'error')
				wiki_page_base.send_page()
				return
			self.request.theme.add_msg('Register token on: '+auth_url, 'info')
			try:
				self.prepend_to_wiki_page(_wiki_base+'/Log', 'Step two: Register your OAuth token on mendeley.com', """\
 * If you have a backup of the file {{{mendeley_api_keys.pkl}}}, upload it here [[attachment:%s/Config/mendeley_api_keys.pkl]].
 * Otherwise [[%s|click here]] to register your token on mendeley.com. Then enter the verification code here: 
{{{#!html 
<form action="submit" method="GET">
<input type="hidden" name="action" value="Mendeley2Moin" />
<input type="hidden" name="token" value="%s" />
<input type="text" name="verifier" value="" size="36" />
<input type="submit" name="submitVerifier" value="Submit" />
</form>
}}}
""" % (_wiki_base, auth_url, wikiutil.escape(self.mendeley_importer.mendeley.request_token.to_string())))
			except Exception as e:
				self.request.theme.add_msg('Could not edit page "'+_wiki_base+'/Log": '+pformat(e), 'error')
				Page(self.request, self.pagename).send_page()
				return
			Page(self.request, _wiki_base+'/Log').send_page()
			return
		
		#Get path of file with authenticated tokens and load it.
		self.config['api_keys_pkl_dir'] = AttachFile.getAttachDir(self.request, _wiki_base+'/Config')
		try:
			self.mendeley_importer.load_keys(self.config['api_keys_pkl_dir'])
		except Exception as e:
			self.request.theme.add_msg('Could not authenticate to Mendeley: '+pformat(e)+traceback.format_exc(), 'error')
			Page(self.request, self.pagename).send_page()
			return
		
		#=== Start with actual plugin ===
		
		#read in documents and folders from Mendeley
		logstring = ''
		try:
			text_output = '=== Mendeley Documents ===\n'
			fold = self.mendeley_importer.get_folders()
			docs = self.mendeley_importer.get_documents(int(self.config['mendeley_folder']))
		except ValueError as e:
			self.request.theme.add_msg('Error while calling Mendeley API: '+pformat(e)+traceback.format_exc(), 'error')
			Page(self.request, self.pagename).send_page()
			return
		
		#if GET parameter 'import' is set, import/update the appropriate documents
		if self.request.values.has_key('import'):
			import_id = self.request.values['import']
			for doc in docs:
				if import_id=='all' or import_id=='new' or import_id==doc['id']:
					try:
						#If wiki page for document exists, update it. Otherwise create new page and import.
						if Page(self.request, doc['citation_key']).exists():
							if import_id!='new':
								self.update_mendeley_doc(doc)
								logstring += 'Successfully updated %s\n' % (doc['citation_key'])
						else:
							self.import_mendeley_doc(doc)
							logstring += 'Successfully imported %s\n' % (doc['citation_key'])
					except PageEditor.Unchanged:
						pass
					#Download files attached to documents
					if self.config['enable_copy_pdf']=='True':
						try:
							#If wiki page for document exists, update it. Otherwise create new page and import.
							if Page(self.request, doc['citation_key']).exists():
								if import_id!='new':
									if self.import_mendeley_attached_file(doc):
										logstring += ' -> Downloaded file %s.pdf\n' % (doc['citation_key'])
									#raise ValueError("asdf")
							else:
								self.import_mendeley_attached_file(doc)
						except Exception as e:
							logstring += 'WARNING: Could not import attached file from mendeley: %s\n' % (pformat(e))
		
		#prepare print out of documents with links to pages and links to import/update
		for doc in docs:
			if(Page(self.request, doc['citation_key']).exists()):
				text_output += "|| [["+doc['citation_key']+"]] || "+doc['title']+"|| <<Action(Mendeley2Moin, Update, import="+doc['id']+")>> ||\n"
			else:
				text_output += "|| "+doc['citation_key']+" || "+doc['title']+"|| <<Action(Mendeley2Moin, Import, import="+doc['id']+")>> ||\n"
		text_output += '\n<<Action(Mendeley2Moin, Import all documents, import=all)>>\n'
		#prepare print out of list of folders
		text_output += '\n=== Mendeley Folders ===\n|| ID || Name ||\n'
		for folder in fold:
			text_output += '|| %s || %s ||\n' % (folder['id'], folder['name'])
		
		#now print all prepared stuff out
		self.request.formatter.page = Page(self.request, self.pagename)
		self.output_content_with_header_and_footer(self.request.formatter.rawHTML('<pre>'+wikiutil.escape(logstring)+'</pre>')+\
			wikiutil.renderText(self.request, WikiParser, text_output))