[Zope-dev] invokeFactory problem
I have a portal_type called ClientBill. I can create it by using the folder_factories script no problem. I want to create one in the users home folder programatically, when they register in the portal. I have been able to do stuff like this before no problem so i copied and pasted the (other working) code and customized it to this. request = container.REQUEST RESPONSE = request.RESPONSE portal = context.portal_url.getPortalObject() myPath=context.portal_url.getRelativeUrl(context) contact = context.sql_getContact(username=username) homeFolder = portal.portal_membership.getHomeFolder(id=username) if contact and homeFolder: if (int(contact[0]['ContactTypeId']) == int(context.CONTACT_TYPE_CLIENT)): homeFolder.invokeFactory(type_name='ClientBill', id='Monthly_Bill', title='Services you will be billed for', remote_url=myPath) #clientBill = getattr( homeFolder, Monthly_Bill ) #clientBill.propertysheets.ClientBill.manage_changeProperties(request) RESPONSE.redirect(contactList?ContactTypeId= + str(context.CONTACT_TYPE_CLIENT)) The problem is that i get this error when i execute the script. (specifically, on the invokeFactory line) Error Type: KeyError Error Value: id I cant see why im getting this error, anyone have any suggestions? Thanks in advance for any help. Dek ___ Zope-Dev maillist - [EMAIL PROTECTED] 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] ZCVSMixin Import Error
Has anyone ever got an error similar to the one below when trying to import files thru ZCVSMixin (AFTER they were exported from same application) The file was not modified in any way but it refuses to re-import after being exported. Failed Imports /var/workspace//350nice/products/orderitnice/zopecontent/portal_skins/orderitnice/Contacts/addAddress.xml Failed Messages Traceback (most recent call last): File /var/workspace/350nice/zope/lib/python/Products/ZCVSMixin/ZCVSMixin.py, line 924, in filesToObjects ob=self._container_p_jar().importFile(fname) File /var/workspace/350nice/zope/lib/python/ZODB/ExportImport.py, line 72, in importFile raise POSException.ExportError, 'Invalid export header' ExportError: Invalid export header ___ Zope-Dev maillist - [EMAIL PROTECTED] 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] why cant i import types
Can someone tell me why i cant import types into my python script in CMF? When i put either of the following lines as the first line of my script i get the error that follows from types import * - produces Error Type: ImportError Error Value: from types import * is not allowed from types import ListType - produces Error Type: ImportError Error Value: import of ListType from types is unauthorized. You are not allowed to access ListType in this context ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] FileUpload questions
Its handy enough to implement. lets say your file parameter is called 'file'... #os_uploadCacheImage is a Zope External method. if request.has_key('file'): context.os_uploadCacheImage(context.PATH_CACHE, request['file'], request['file'].filename) #co-responding implementation for zope external method os_uploadCacheImage def uploadCacheImage(self, basePath, file, filename): cacheFile = open(basePath + / + filename, wb) cacheFile.write(file.read()) cacheFile.close() --- J Cameron Cooper [EMAIL PROTECTED] wrote: I have been looking at the FileUpload class defined in HTTPRequest.py but am still a little confused about how it works. When a form is submitted with an input type=file ..., where are the contents of the uploaded file stored? Is it automatically stored in the ZODB, or is it stored in memory until some other code (like that in Image.py) stores it? The reason I am asking is that I want to store uploaded files on the file system instead of in the ZODB. (We are running Zope behind an Apache web server, so the uploaded files will be placed under Apache's document root so they can be served directly by Apache.) Being new to Zope and Python, it is not clear to me exactly how to go about this. Don't bother mucking around in the core. The right way to do it is to use a Product that stores data on the fiesystem, acting as a facade. Look at LocalFS, ExtFile/ExtImage, ExternalFile, and possibly APE. Probably LocalFS or ExternalFile are most interesting to you. http://sourceforge.net/projects/localfs http://zope.org/Members/arielpartners/ExternalFile http://zope.org/Members/MacGregor/ExtFile http://hathaway.freezope.org/Software/Ape --jcc ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 - [EMAIL PROTECTED] 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 )