Attachment 'xapianIndex.py'

Download

   1 import sys,os
   2 sys.path.append("c:\moin")
   3 
   4 from MoinMoin.web import contexts
   5 from MoinMoin.Page import Page
   6 
   7 class ScriptContext(contexts.AllContext):
   8 	"""
   9 	added REMOTE_USER to wsgi environ
  10 	"""
  11 	def __init__(self, user, url=None, pagename=''):
  12 		if url is None:
  13 			url='http://localhost:0/' # just some somehow valid dummy URL
  14 		environ=contexts.create_environ(base_url=url) # XXX not sure about base_url, but makes "make underlay" work
  15 		environ['HTTP_USER_AGENT']='CLI/Script'
  16 		environ['wsgi.input']=sys.stdin
  17 		environ['REMOTE_USER']=user
  18 		request=contexts.Request(environ)
  19 		super(ScriptContext, self).__init__(request)
  20 		from MoinMoin import wsgiapp
  21 		wsgiapp.init(self)
  22 
  23 def _get_index(request):
  24 	try:
  25 		from MoinMoin.search.Xapian import XapianIndex
  26 		return XapianIndex(request)
  27 	except ImportError:
  28 		pass
  29 
  30 if __name__ == '__main__':
  31 	request=ScriptContext("mscheufe")
  32 	if request.cfg.xapian_search:
  33 		index=_get_index(request)
  34 		if index and index.exists():
  35 			page=Page(request,"SANDBOX/fred2/test")
  36 			print page.page_name
  37 			try:
  38 				index.update_item(page.page_name)
  39 			except Exception ,e:
  40 				print "CATCHED excpetion %s" % str(e)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2012-07-22 19:09:39, 1.6 KB) [[attachment:fakerequest.diff]]
  • [get | view] (2012-05-02 12:20:55, 49.6 KB) [[attachment:iis_unhandled_exception.jpg]]
  • [get | view] (2012-05-02 12:20:34, 2.2 KB) [[attachment:moinmoinloader193ErrorCatch.py]]
  • [get | view] (2012-05-02 12:19:52, 1.2 KB) [[attachment:xapianIndex.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.