Re: [Zope-dev] ZPattens Question? Guestbook example
James Johnson wrote: > > I wonder if you are planning on releasing some UML stuff related to > ZPatterns and Zope? I don't think UML is a very good match for describing either the internals of ZPatterns, or for describing systems built using ZPatterns -- or Zope for that matter. > I use a Freeware product called DOME. It has > support for UML and COAD-YOURDON OOA. For Zope and ZPatterns work, I prefer the Coad notation to UML. It is more Object-oriented, whereas UML is more class-oriented. I tend to use a whiteboard and digital camera for modeling work. Either that, or pens and paper. > I'm don't have any formal > training so I'm still trying to figure out what it all means. Keep on figuring. I think you're doing ok :-) > If you have any example diagrams that you can share that would be > most kind. What would you most like a diagram of? I find diagrams generally most useful when they come along with a description in words. > Here is the code I was trying to use in the first place. > > Inserting new Guest Book Table Info Item! > I can see what you're trying to do here. You can't do it like this though. You can't use "len" or "self" in dtml. The variable "self" is kind of taken as read in most cases. Use "_.len()" for "len()". So, you could use However, although this will return a value, it still won't do what you want. The items that you store in a specialist actually live in a Rack. They are not visible as normal sub-objects that you can access using self.objectIds(). The number returned by len(self.objectIds()) represents the number of DTML methods, DTML documents, folders, External methods, Python methods, images, files and so forth, plus the number of Racks and Data-PlugIns in the specialist. Rather that try to give you new item a unique sequential id, try just giving it a unique id. You can use a method in a Rack called "newKey" for this. Then, this method will be called to determine the new id, you pass _.None (from DTML) or None (from a Python method or an External method). I use this external method to generate a new unique key for my racks. I put this inside the Rack, from the rack's methods tab. from DateTime import DateTime def newKey(self): # self is a rack instance fk = lambda x: 'entry-%d' % x n = int(DateTime().timeTime()) max_tries = 10 key = fk(n) while max_tries and self.getItem(key) is not None: n = n + 1 max_tries = max_tries-1 key = fk(n) return key > ni="Guestbook.newItem(id)"> > > (id='GBookProps', ns='')"> You'll want a dtml-let here I should think. > nips="ni.propertysheets.get('GBookProps')"> > 'string')"> > > And, of course, another dtml-let closing tag here. > -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Proposal: local classes
I want to be able to have a class I can use in a subtree for things like encapsulating database rows etc. Python and ZClasses seem to be a bit heavy weight for something I don't want to use in other contexts. Is there any reason why ZClasses can't be modified to live in a folder as well as a product? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Re: [Zope-dev] ZPattens Question? Guestbook example
I wondered why my post looked so bad. Thanks. I wonder if you are planning on releasing some UML stuff related to ZPatterns and Zope? I use a Freeware product called DOME. It has support for UML and COAD-YOURDON OOA. I'm don't have any formal training so I'm still trying to figure out what it all means. If you have any example diagrams that you can share that would be most kind. Here is the code I was trying to use in the first place. Inserting new Guest Book Table Info Item! ni="Guestbook.newItem(id)"> nips="ni.propertysheets.get('GBookProps')"> >You can use ZPatterns from DTML alone quite easily. However, some >things >are easier from an external method or a python method. I hope it happens soon. Jimbo Get your Free E-mail at http://tacoma.zzn.com Get your own Web-Based E-mail Service at http://www.zzn.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ZPattens Question? Guestbook example
Hi James, Please don't post to the list in HTML. James Johnson wrote: > > Hello, > I'm trying to get the basic app building concept down with > ZPatterns. > Forgive me if I'm way off the mark. I'm building off the guest > book > example from the new Zope book. What I've done is created a > product > folder call Gbook. Inside I've created a dtml method index_html, a > specialist named Guestbook and a Dataskin instance called > Guestbook_entry. I have one property sheet named GBookProps defined > for dataskin ZClass. Instead of storing the guestbook entries in > documents I'm trying to store them using the dataskin database. > > In the Specialist(Guestbook) I have 3 methods addEntry, > addEntryAction, and addEntryForm > When I call addEntry I get. > TypeError > sequence-index must be an integer > I thought I was so close to understanding me not understanding. :) > It seems to me that the "only" way to produce a ZPatterns based > product is to do it from python. > How about this, should I be trying to add entries this way? > """dtml method addEntry""" > > > Inserting new Guest Book Table Info Item! > > ni="newItem(Guestbook)"> > This is a bit odd -- you're closing your dtml-let tag immediately after opening it. Also, I don't understand your call to newItem. You should be passing an id into it. > (id='GBookProps', ns='' You probably ought to close the bracket, quote and tag here. > The variable "ni" won't be bound to anything in particular here. > 'string')"> > > > > > > > You can use ZPatterns from DTML alone quite easily. However, some things are easier from an external method or a python method. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ZPattens Question? Guestbook example
Hello, I'm trying to get the basic app building concept down with ZPatterns. Forgive me if I'm way off the mark. I'm building off the guest book example from the new Zope book. What I've done is created a product folder call Gbook. Inside I've created a dtml method index_html, a specialist named Guestbook and a Dataskin instance called Guestbook_entry. I have one property sheet named GBookProps defined for dataskin ZClass. Instead of storing the guestbook entries in documents I'm trying to store them using the dataskin database. In the Specialist(Guestbook) I have 3 methods addEntry, addEntryAction, and addEntryForm When I call addEntry I get. TypeError sequence-index must be an integer I thought I was so close to understanding me not understanding. :) It seems to me that the "only" way to produce a ZPatterns based product is to do it from python. How about this, should I be trying to add entries this way? """dtml method addEntry""" Inserting new Guest Book Table Info Item! ni="newItem(Guestbook)"> (id='GBookProps', ns='')"> 'string')"> Thanks, Jimbo Hitz N Bitz member http://www.tacomaplace.com http://bbs.tacomaplace.com Get your Free E-mail at http://tacoma.zzn.comGet your own Web-Based E-mail Service at http://www.zzn.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] PLEA: Provide feedback on OracleStorage
Hello sports fans. Last week we released a beta of OracleStorage. There was a pretty strong drumbeat in Zopeland for us to go ahead and get this out. We spent some extra time on the installation process and instructions to make sure it was straightforward to use. We at DC would like to get OracleStorage hardened as fast as possible. Thus, I have a serious of requests: a. If you are interested in it, please download it this week and give it a shot. b. If you downloaded it, please send me a note and tell me so. c. If you find any bugs with it, please file something in the Collector. We'll make sure there's a keyword for OracleStorage. d. If you have a general question, request, or discussion, start a thread here in zope-dev. My indebtedness goes out to anybody that can help us on this. Thanks! --Paul ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] not being set under some circumstances
Steve Alexander wrote: > > Zope 2.2.1 > > Zope is not setting the tag in the html header under some > circumstances. > > To get a reproducable example of this, create a folder "test" under the > zope root object. > > Inside "test" create a new dtml document called "body_html". Leave the > content of body_html as the default. > > Now, view the page, and view its source. You'll see no element. > > Is this intentional? Yes. This should be a FAQ. > Does Zope now not bother with the body element if > it doesn't think it is needed? Yes. > This would seem to be the rationale > behind the request attribute "request._hacked_path". > > Comments? This is needed because sometimes Zope does hack the path, for example when index_html or :method form types are used. The base href is needed in these cases to make sure that relative URLs are treated correctly. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Technical Director (888) 344-4332 Python Powered! Digital Creationshttp://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] not being set under some circumstances
Zope 2.2.1 Zope is not setting the tag in the html header under some circumstances. To get a reproducable example of this, create a folder "test" under the zope root object. Inside "test" create a new dtml document called "body_html". Leave the content of body_html as the default. Now, view the page, and view its source. You'll see no element. Is this intentional? Does Zope now not bother with the body element if it doesn't think it is needed? This would seem to be the rationale behind the request attribute "request._hacked_path". Comments? -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] (no subject)
LEARN HOW TO GET YOUR OWN 5 MEG WEBSITE FOR ONLY $11.95 PER MONTH TODAY! STOP PAYING $19.95 or more TODAY for your web site, WHEN YOU CAN GET ONE FOR ONLY $11.95 PER MONTH! DO YOU ALREADY HAVE A WEBSITE? ALL YOU HAVE TO DO IS TRANSFER THE DOMAIN TO OUR SERVERS AND UPLOAD YOUR DATA AND YOU ARE READY TO GO! YOUR NEW WEB SPACE CAN BE CREATED INSTANTLY WITH JUST A SIMPLE PHONE CALL TO OUR OFFICE. FRONT PAGE EXTENSIONS FULLY SUPPORTED! YOU CAN CHANGE THE DESIGN OF YOUR SITE AS MUCH AS YOU WANT with no extra charge! UNLIMITED TRAFFIC -- no extra charge! A SET UP FEE OF $40.00 APPLIES for FIRST TIME CUSTOMERS. ALL FEES PREPAID IN ADVANCE FOR THE YEAR PLUS A $40.00 SET UP CHARGE. FOR DETAILS CALL 1 888 248 0765 WEB HOSTING INTERNATIONAL 2001 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ZPatterns transactions bug
Here's a trace of all the transaction calls to do with a particular customizer. I have instrumented ZPatterns.Transactions.Transactional like this: def _register(self): if self.id=='customize_items': print "\n -- REGISTER %s" % self._v_registered if self._v_registered: return get_transaction().register(Reporter(self)) self._v_registered = 1 def _unregister(self): try: del self._v_registered if self.id=='customize_items': print "\n_unregister: NORMAL OPERATION" # import traceback # traceback.print_stack() except: print "\n\n_unregister: ERROR" # import traceback # traceback.print_stack() ZPatterns.Transactions.Reporter in most of the methods. Specifically: def tpc_begin(self, transaction, subtransaction=None): if self.client.id=='customize_items': print '\n -- TPC begin %s sub=%s' % (self, subtransaction) self.tpc_entered = 1 Also: ZCatalog.py def catalog_object(self, obj, uid): """ wrapper around catalog """ self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold)) if self.threshold is not None: if self._v_total > self.threshold: print ' -- ZCatalog commit subtransaction start' # commit a subtransaction get_transaction().commit(1) # kick the chache, this may be overkill but ya never know self._p_jar.cacheFullSweep(1) self._v_total = 0 print ' -- ZCatalog commit subtransaction complete' The trace starts when I try to update a ZCatalog containing lots of DataSkin-derived instances. -- REGISTER 0 ... lots of REGISTER 1 -- REGISTER 1 -- ZCatalog commit subtransaction start -- TPC begin sub=1 -- TPC commit -- TPC finish -- TPC end tran _unregister: NORMAL OPERATION -- ZCatalog commit subtransaction complete -- REGISTER None -- REGISTER 1 -- TPC begin sub=1 -- TPC commit -- TPC finish -- TPC end tran _unregister: NORMAL OPERATION -- TPC commit_sub -- TPC begin sub=None -- TPC commit_sub -- TPC begin sub=None _unregister: ERROR, can't del self._v_registered I don't know enough about ZODB transactions, and the intent of ZPatterns.Transactions to do anything more at present. I did note in ZODB/Transaction.py this comment. Perhaps it is relevant? # - For every jar for which we've called tpc_begin on, # we either call tpc_abort or tpc_finish. It is OK # to call these multiple times, as the storage is # required to ignore these calls if tpc_begin has not # been called. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ZPatterns: transaction bug
**Darn**; I pressed the send button on my mail client by accident while still working on this one. Ignore the last message. I think the error is to do with the way that ZPatterns.Transactions.Reporter doesn't do anything special for subtransactions. On committing a subtransaction, it commits the top-level transaction that it knows about. Then again, I'm new to the way ZODB handles transactions, so I might well be wrong here. More later... -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ZPatterns: transaction bug
While updating a load of DataSkins all together using a ZCatalog, I got this error: 2000-09-03T08:03:13 PANIC(300) ZODB A storage error occurred in the last phase of a two-phase commit. This shouldn't happen. The application may be in a hosed state, so transactions will not be allowed to commit until the site/storage is reset by a restart. Traceback (innermost last): File lib/python/ZODB/Transaction.py, line 296, in commit File lib/python/Products/ZPatterns/Transactions.py, line 108, in tpc_finish File lib/python/Products/ZPatterns/Transactions.py, line 137, in end_tran File lib/python/Products/ZPatterns/Transactions.py, line 48, in _unregister (Object: ProviderContainer) KeyError: _v_registered The line from Transactions.py in question is: def _unregister(self): del self._v_registered >From a little bit of instrumentation, I see that one of my Customizer instances is getting unregistered twice in a row. An obvious naive fix is to put the del line in a try-except block, or to change it to if self._v_registered: del self._v_registered >From a lot of instrumenting code, tinkering and reading up on the ZODB transaction system, I think I've found what the problem is. The error happens when the ZCatalog attempts to commit a subtransaction. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )