[Zope] ZODB and Reportlab
Hi: I need to report my all "CDClass" in one pdf document. For do that i want to use the reportlab libs, but i don't know how i can access to my all "CDClass" with a External Method. I have a solution but i think that isn't the best: list all "CDCLass" with a DTMLmethod and pass that list to the my ExternalMethod. My question is: what is the best way for doing that task? Thanks Very Much in advance Have a nice day. JoRgE ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Zope 2.20 and SQLSession
Hi Since i upgrade my zope 2.14 to 2.20 i can't access to my all DTML Method's which use the SQLSESSION session. I try view these method's with superuser permissions but a have this error message: Zope Error Zope has encountered an error while publishing this resource. Unauthorized Sorry, a Zope error occurred. Traceback (innermost last): File /usr/local/ZopeNovo/Zope/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /usr/local/ZopeNovo/Zope/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/ZopeNovo/Zope/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/ZopeNovo/Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: novasessao) File /usr/local/ZopeNovo/Zope/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: novasessao) File /usr/local/ZopeNovo/Zope/lib/python/OFS/DTMLMethod.py, line 167, in __call__ (Object: novasessao) File /usr/local/ZopeNovo/Zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__ (Object: novasessao) File /usr/local/ZopeNovo/Zope/lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob (Object: validar(SENHA=senha)) File /usr/local/ZopeNovo/Zope/lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob (Object: idprof(SENHA=senha)) File /usr/local/ZopeNovo/Zope/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval (Object: SESSION.set('idprofessor',profid)) (Info: profid) File , line 0, in ? File /usr/local/ZopeNovo/Zope/lib/python/DocumentTemplate/DT_Util.py, line 142, in careful_getattr File /usr/local/ZopeNovo/Zope/lib/python/OFS/DTMLMethod.py, line 189, in validate (Object: novasessao) File /usr/local/ZopeNovo/Zope/lib/python/AccessControl/SecurityManager.py, line 139, in validate File /usr/local/ZopeNovo/Zope/lib/python/AccessControl/ZopeSecurityPolicy.py, line 159, in validate Unauthorized: set In Zope 2.14 all run ok :-) Jorge ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Reportlab and Zope
Hi: In this post i report my experience with Reportlab in Zope: 1. Install the Reportlab package in /usr/local/Zope/lib/python1.5 directory 2. in the Zope directory i create a sub folder ./pdffiles and: > cd /usr/local/Zope/pdffiles > su > chmod 777 3. in the Extensions folder i create ### #mymodule.py ### import string from reportlab.pdfgen.canvas import Canvas from reportlab.lib.pagesizes import A3, landscape from reportlab.pdfgen.textobject import PDFTextObject from types import * def helloworld(): c = Canvas("./pdffiles/helloworld.pdf", pagesize=landscape(A3), bottomup=0) c.setFont("Times-Roman", 12.0, leading=10.0) c.drawString(100,100, "Hello World") c.showPage() c.save() 4. In Zope: External module: ID: HelloW function: helloworld module: mymodule Local File System ID: Hello patch: /usr/local/Zope/pdffiles DTML Method: ID: HelloWorld See the pdf file ... My question is: How i can insert the contents of the Local File System in to HTML environment? Have a nice day Jorge ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] RE: Reportlab and Zope
In my last post i search for help concerning to the use of the libs Reportlab in to Zope environment. I make some research in Reportlab mailing list and Osmin Lazo (Canada) suggests my to use the following buffer class # Buffer Class class buffer: def __init__(self): self._buffer = [] self._size = 0 def write(self,line): self._buffer.append(str(line)) def read(self): data = string.join(self._buffer, '') return data def tell(self): return len(self._buffer) My fistreportlabinzope.py is: # # firstreportlabinzope.py ## import string from reportlab.pdfgen.canvas import Canvas from reportlab.lib.pagesizes import A3, landscape from reportlab.pdfgen.textobject import PDFTextObject from types import * class buffer: def __init__(self): self._buffer = [] self._size = 0 def write(self,line): self._buffer.append(str(line)) def read(self): data = string.join(self._buffer, '') return data def tell(self): return len(self._buffer) stream = buffer() c = Canvas(stream, pagesize=landscape(A3), bottomup=0) c.setFont("Times-Roman", 12.0, leading=10.0) c.drawString(100,100, "Hello World") c.showPage() c.save() tempfile=open("helloworld.pdf","wb") tempfile.write(stream.read()) temfile.close() 3 My main problem is: When i tried to add the External method i have the following error message: IOERROR: [Errno 13] Permission Denied 'helloworld.pdf' How i can fix it? Have a nice day Jorge ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Reportlab and Zope
Hi: I try to use Reportlab lib's with my zope. In my DTML method i call the python file (External Method) with: All run OK, but i don't find the *pdf file. Where is my pdf file? ##3 # makereport.py ##3 import string from reportlab.pdfgen.canvas import Canvas from reportlab.lib.pagesizes import A3, landscape from reportlab.pdfgen.textobject import PDFTextObject from types import * import MySQL x=y=100 turmaa = 'Michael' DBH = MySQL.connect("localhost","aa","bb") DBH.selectdb("school") query= ("select score from exam where name= %s") % repr(turmaa) STH1= DBH.query(query) Scores= STH1.fetchrows(-1) c = Canvas("score.pdf", pagesize=landscape(A3), bottomup=0) c.setFont("Times-Bold", 12.0, leading=10.0) for scor in range(len(Scores)): c.drawString(x, y, Scores[scor][0]) y = y + 15 c.showPage() c.save() DBH.close() thanks in advance have a nice day Jorge ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )