[Zope] Help needed with namespace
Hello all, after updating to Zope-2.2.0 I have problems with ZSQL methods. It seems as if the namespace of ZSQL methods has changed sind Zope-2.1.x. I cannot access the AUTHENTICATED_USER object anymore - it is not known to ZSQL methods: dtml-sqlvar AUTHENTICATED_USER gives an "Missing input variable, AUTHENTICATED_USER" error and dtml-var "AUTHENTICATED_USER.getUserName()" gives "error type: NameError error value: AUTHENTICATED_USER" The security mechanism of my application heavily depends on this object! What has happened to the ZSQL methods? I have already updated to Zope-2.2.2 but with no luck so far. Any help is greatly appreciated, Andreas ** This email message has been swept by MIMEsweeper for the presence of computer viruses. Francotyp-Postalia AG Co. ___ 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 )
Re: [Zope] ZODBCDA fails under 2.2
I'm trying to access data via the ZODBCDA latest build and Zope 2.2 Whenever the ODBC query returns data, the user is challenged for authentication. Pages that do not use ODBC and database methods that return empty sets are not challenged. Has anyone else encountered this? Yes, I have the same problems with ZODBCDA and Zope-2.2. I still haven't found out what exactly causes this error. In my configuration, anonymous has acquired "Access", "View" and "use db methods" rights. I've also tried with explicit rights. It doesn't work for me as a manager either... Andreas ** This email message has been swept by MIMEsweeper for the presence of computer viruses. Francotyp-Postalia AG Co. ___ 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 )
RE: [Zope] Q: Accessing ZSQL methods from Python
-Original Message- From: Dieter Maurer [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 08, 2000 10:21 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [Zope] Q: Accessing ZSQL methods from Python [EMAIL PROTECTED] writes: my question is what type or value is returned by a ZSQL method that is invoked from Python? ZSQL methods return "Shared.DC.ZRDB.Results.Results" instances. Such an instance essentially behaves like a sequence of objects each describing one result row. These objects have been set up such that a column value can be accessed as attribute with the column name. Thus, "results[i].column" gives the value of "column" of the i.th row. Yes, that works fine. But I need to know of NULL values. How to determine, how "Null" values are recognized, is less a Zope than a database adapter question. I would expect, that most (if not all) database adapters will map SQL Null to None. That was what I thought but at least ZODBC won't do this. What I have found out is, that repr(SQL NULL) == 'Missing.Value'. However, even some well established SQL databases do not treat Null standards-conform but represent it as the empty string. Then, the database adapter has no chance to map this to None but must use '', too. ZODBC won't do this either. Dieter Andreas ** This email message has been swept by MIMEsweeper for the presence of computer viruses. Francotyp-Postalia AG Co. ___ 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] Q: Accessing ZSQL methods from Python
Hi all, my question is what type or value is returned by a ZSQL method that is invoked from Python? Or, more precisely, how can I determine if a field contains a NULL value? Sample code: def myZSQLAccessFromPython(self, aParameter): """myZSQLAccessFromPython() returns a record set from a database table.""" #Call the ZSQL method rs = self.zsqlMethod(parameter=aParameter) if len(rs) == 1: #I expect exactly one result column if rs[0].field is not NULL: - How to code this? rs[0].field == None does not work Do_some_interesting_work() TIA, Andreas ** This email message has been swept by MIMEsweeper for the presence of computer viruses. Francotyp-Postalia AG Co. ___ 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] Q: Accessing a ZSQL Method from an External Method
Hi all, I want to use ZSQL Methods from within External Methods and have already read the appropriate HowTo but it is somehow vague in some respects and I have some problems with my adaption. I have ZSQL methods in a subfolder /SQL, eg. /SQL/sqlZuordnung My External Method named "extShow" should use the ZSQL method sqlZuordnung: def Show(self, zuordnungsbereich, zuordnung): """Show retrieves some database items.""" res=self.SQL.sqlZuordnung(zuordnungsbereich=zuordnungsbereich, zuordnung=zuordnung) fields2index={} fieldnames=res._schema.items() for i in range(len(fieldnames)): fields2index[fieldnames[i][0]]=fieldnames[i][1] id_val=res[0][fields2index['ID']] return id_val First, I want to know how to call this function, especially how to submit the correct namespace. Calling it with dtml-var "extShow(_, zuordnungsbereich, zuordnung)" results in an AttributeError (SQL). Here's a TraceBack: !-- Traceback (innermost last): File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 214, in publish_module File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 179, in publish File C:\PROGRA~1\graffias\lib\python\Zope\__init__.py, line 202, in zpublisher_exception_hook (Object: ElementWithAttributes) File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 165, in publish File C:\PROGRA~1\graffias\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: index_html) File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 102, in call_object (Object: index_html) File C:\PROGRA~1\graffias\lib\python\OFS\DTMLMethod.py, line 150, in __call__ (Object: index_html) File C:\PROGRA~1\graffias\lib\python\DocumentTemplate\DT_String.py, line 502, in __call__ (Object: index_html) File C:\PROGRA~1\graffias\lib\python\DocumentTemplate\DT_Let.py, line 145, in render (Object: umgebung=quot;this()quot;) File C:\PROGRA~1\graffias\lib\python\DocumentTemplate\DT_Util.py, line 335, in eval (Object: Methoden.extShow(_,'Bereich',Test)) (Info: Test) File lt;stringgt;, line 0, in ? File C:\PROGRA~1\graffias\lib\python\Products\ExternalMethod\ExternalMethod.py, line 248, in __call__ (Object: extShow) (Info: ((lt;TemplateDict object at 1b97e20gt;, 'Bereich', Test), {}, None)) File C:\PROGRA~1\graffias\Extensions\functions.py, line 132, in Show AttributeError: (see above) -- So, what am I doing wrong here? TIA, Andreas ** This email message has been swept by MIMEsweeper for the presence of computer viruses. Francotyp-Postalia AG Co. ___ 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 )