Re: [Zope-dev] SVN: zope.server/branches/achapman-exc-info/src/zope/server/http/ further compliance with WSGI PEP.
On May 17, 2011, at 12:02 PM, Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/17/2011 10:14 AM, Satchidanand Haridas wrote: --- zope.server/branches/achapman-exc-info/src/zope/server/http/wsgihttpserver.py 2011-05-17 12:41:54 UTC (rev 121686) +++ zope.server/branches/achapman-exc-info/src/zope/server/http/wsgihttpserver.py 2011-05-17 14:14:20 UTC (rev 121687) @@ -77,12 +77,16 @@ env = self._constructWSGIEnvironment(task) def start_response(status, headers, exc_info=None): +if task.wroteResponseHeader() and not exc_info: +raise AssertionError(start_response called a second time + without providing exc_info.) if exc_info: try: if task.wroteResponseHeader(): raise exc_info[0], exc_info[1], exc_info[2] else: -pass +# As per WSGI spec existing headers must be cleared +task.accumulated_headers = None finally: exc_info = None # Prepare the headers for output @@ -110,12 +114,16 @@ env['wsgi.handleErrors'] = False def start_response(status, headers, exc_info=None): +if task.wroteResponseHeader() and not exc_info: +raise AssertionError(start_response called a second time + without providing exc_info.) if exc_info: try: if task.wroteResponseHeader(): raise exc_info[0], exc_info[1], exc_info[2] else: -pass +# As per WSGI spec existing headers must be cleared +task.accumulated_headers = None finally: exc_info = None # Prepare the headers for output I think AssertionError is the wrong type of exception here: it has debugging / testing semantics which seem inappropriate. I think we would be better of raising an instance of a WSGI-specific exception type The WSGI PEP doesn't specify any WSGI specific exceptions. - The sample CGI example that the PEP provides also raises an AssertionError for this scenario: http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side Also note that Paste's HTTP server (Paster) and CherryPy both raise AssertionErrors for this scenario: - Paste: https://bitbucket.org/ianb/paste/src/4f5cfde87603/paste/httpserver.py#cl-166 - CherryPy: http://www.cherrypy.org/browser/trunk/py2/cherrypy/wsgiserver/__init__.py#L2050 Can you clarify what you meant by a WSGI-specific exception type? Thanks for the careful testing! Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk3Sm/gACgkQ+gerLs4ltQ7oVQCfa0vEWPcASmLdO2BDeEzoeI5j eZYAniT/BCbFojmKxjq0did6wXLmmmiG =udSc -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope ) Satchidanand Haridas Software Engineer, Zope Corporation ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ZopePublication Competing writes/reads
What version of zope.session are you using? A fix (using zope.minmax) for ConflictErrors related to the update of access time on sessionData object was committed into zope.session in rev76899. Not sure if that solves this problem of conflict errors that you see, but if you are using a version of zope.session prior to r76899, upgrading may make those problems go away. Regards, Satchit On Oct 22, 2008, at 10:27 AM, Carsten Senger wrote: Hermann Himmelbauer schrieb: Yes, I can reproduce this any time. But I looked into it further, and it's quite weird: - If I access the site without having logged in (= a new cookie/ session is created), it does not happen. - If I login, pressing F5 rapidly triggers these warnings. - BUT: If I logout and press F5, the warnings are still there. - If I close the browser/reopen it (- New session), the warning is gone. So it seems, once the session stores/has stored login information, this object leads to a conflict. Interesting - but I still don't know what this object is. You should inspect what happens in zope.session to find out what happens there. From your description and the purpose of sessions probably this happens: Everytime you access you site the session is checked for authentication informations. Sessions have a set timeout. zope.session has to write a new timestamp into the session so it can drop the session after the timeout. This can cause conflicts. When you log out the authentication informations are removed from the session, but the cookie an the server side session are still there. The timestamp is updated with every request. If you close your browser the cookie is removed by the browser. Until you authenticate zope does not create a new session/set a new cookie. I'm quite sure that you can't get conflicts with zope.session if you use two different sessions at the same time and conflicts with one session are rare enough and with zope's conflict resolution no problem (unless you press F5 really fast) ..Carsten ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope] storing blob data in SQLServer using ZSQL
Hi, How can I save blob data in SQLServer using ZSQLs? I'm using mxODBC. I have a ZSQL that looks something like this: update table_name set blob_data = dtml-sqlvar i_blob_data type=nb where conditions But I get the following error when I run the above ZSQL: ProgrammingError: ('07002', 0, '[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error', 6108) Any comments will be much appreciated. thanks, Satchit ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ExtFile Extention Mappings
Hi, Have you had a look at the Config.py file? I believe you can change the settings there so that the Zope filenames are preserved including the extensions. More specifically, I am referring to the following section in Config.py: section # repository file extension handling ZOPEID = 0 # use ZOPEID (even if it doesn't include an extension) MIMETYPE_APPEND = 1 # append extension to ZOPEID according to mimetype MIMETYPE_REPLACE = 2# remove extension from ZOPEID, then append mime extension REPOSITORY_EXTENSIONS = MIMETYPE_REPLACE /section Thanks. Satchit Edward Pollard wrote: In our quest to replace the not-quite-working External File product, we're looking at ExtFile. However, when I upload files into an ExtFile, file extensions on the file system are being changed. test1.txt becomes test1.ksh, test2.doc becomes test2.dot. They have the correct ID's in the ZMI, but on the file system they now have something quite new. Our solution relies on accessing via the ZMI and the file system at the same time, so the name being changed is somewhat inconvenient in its unpredictability (and I think Apaches mime types will get nicely screwed if we start bypassing Zope to get at them). I've done some poking at the source code but don't see why ExtFile is doing this or what logic it uses. I bet someone out there knows. --- Edward J. Pollard, B.Sc Webmaster, University of Lethbridge Ext. 1828 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )