Re: [Zope-dev] ZPatterns + Skinscript
On Sat, 28 Oct 2000, Phillip J. Eby wrote: > At 05:17 PM 10/28/00 +0200, Joachim Schmitz wrote: > > > >select e.event_id as event_id > >,e.zeiten as zeiten > >,v.firma as firma > >,v.tel as tel > >,e.movie_id as movie_id > >,m.movie_title as movie_title > >,m.movie_link as movie_link > >,m.movie_text as movie_text > >,e.datum_von as datum_von > >,e.datum_bis as datum_bis > >from event as e, veranstalter as v, movies as m > >where > >e.event_id = > >and e.movie_id = m.movie_id and e.veran_id = v.veran_id > >order by m.movie_title > > Just out of curiosity, why do you have an "order by" clause, if this is > supposed to only return one row? If more than one item is returned by this > query, only the first will be used to supply data to your DataSkin. > that was just left over from an reused query-template, I forgot to take it out. > > >I also added a SkinScript method as a Data Plug-in in the defaultRack like > this > > > >WITH QUERY readEvents(e_id=self.event_id) COMPUTE zeiten,firma,tel > >,movie_id,movie_text,movie_link,movie_title > >,datum_von,datum_bis,zeiten > > Do you have some way of providing self with an "event_id" value? Keep in > mind that when DataSkins are created, they have only an "id" attribute, > nothing else. So unless you have an attribute provider that provides an > "event_id" value, this statement will fail. Perhaps what you actually mean > is: > > WITH QUERY readEvents(e_id=self.id) COMPUTE > event_id, > zeiten,firma,tel, > movie_id,movie_text,movie_link,movie_title, > datum_von,datum_bis,zeiten > > Notice that I'm passing self.id to readEvents, and that I've added event_id > to the list of attributes retrieved from the query. > how do I set "self.id" I tried in dtml-method in the event-specialist: There is a event_id 609 in the table: returns none or returns none > > >under the storage tab I selected for: > > > >Class to use for stored items: ZPatterns:DataSkin and > > > >Objects are: o stored persistently. > > x loaded by accessing attribute: event_id > > This will work fine, if you use the revised SkinScript above. You will > probably want to create a ZClass subclass of DataSkin at some point to use > instead, so that you can define permissions, methods, and so on for your > Event objects. > > Mit freundlichen Grüßen Joachim Schmitz AixtraWare, Ing. Büro für Internetanwendungen Hüsgenstr. 33a, D-52457 Aldenhoven Telefon: +49-2464-8851, FAX: +49-2464-905163 ___ 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] Streaming?
Is it possible to "stream" (send data to the client via HTTP incrementally) from Python code, or does ZPublisher only send the data as a single wad when the method returns? Assuming it is possible, obviously it requires using some other API rather than just 'return'ing a string... where can I find documentation and/or examples on that? If there is no existing documentation or examples, source code would do. (Context: when the tests are running on ZUnit, I'd like to give some visual feedback, if possible by sending the dots returning by PyUnit in real-time) []s, |alo + -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:[EMAIL PROTECTED] pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar ___ 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] Streaming?
Isn't that dependant on the protocol u are using to transfer the data? HTTP can't do streaming. You can sort of do streaming using the experimental multipart content type, but IE browers don't recognise it, so it is pretty useless. With the context you gave, you could probably do that with the experimental multiplart content, but it would only work with netscape. terry Lalo Martins wrote: > Is it possible to "stream" (send data to the client via HTTP > incrementally) from Python code, or does ZPublisher only send > the data as a single wad when the method returns? > > Assuming it is possible, obviously it requires using some other > API rather than just 'return'ing a string... where can I find > documentation and/or examples on that? If there is no existing > documentation or examples, source code would do. > > (Context: when the tests are running on ZUnit, I'd like to give > some visual feedback, if possible by sending the dots returning > by PyUnit in real-time) > > []s, >|alo >+ > -- > Hack and Roll ( http://www.hackandroll.org ) > News for, uh, whatever it is that we are. > > http://zope.gf.com.br/lalo mailto:[EMAIL PROTECTED] > pgp key: http://zope.gf.com.br/lalo/pessoal/pgp > > Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar > > ___ > 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 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] Streaming?
On Mon, Oct 30, 2000 at 12:23:36PM +1100, Terry Kerr wrote: > Isn't that dependant on the protocol u are using to transfer the data? > HTTP can't do streaming. You can sort of do streaming using the > experimental multipart content type, but IE browers don't recognise it, > so it is pretty useless. What are you talking about? Try to load any standard html page with a very slow connection. If you just send the data slowly, the browser will show it as it is received. That's streaming. You can point an mp3 or realaudio player at an URL and it will download the file and play it as it arrives. That's the kind of streaming I want to do. []s, |alo + -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:[EMAIL PROTECTED] pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar ___ 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] Streaming?
That is not streaming. That is just as you said..lack of bandwidth delaying the entire page arriving at once at you browser. That is not contolled. The server doesn't send it 'bit by bit' in a controlled manner. terry Lalo Martins wrote: > On Mon, Oct 30, 2000 at 12:23:36PM +1100, Terry Kerr wrote: > > Isn't that dependant on the protocol u are using to transfer the data? > > HTTP can't do streaming. You can sort of do streaming using the > > experimental multipart content type, but IE browers don't recognise it, > > so it is pretty useless. > > What are you talking about? Try to load any standard html page > with a very slow connection. If you just send the data slowly, > the browser will show it as it is received. That's streaming. > > You can point an mp3 or realaudio player at an URL and it will > download the file and play it as it arrives. > > That's the kind of streaming I want to do. > > []s, >|alo >+ > -- > Hack and Roll ( http://www.hackandroll.org ) > News for, uh, whatever it is that we are. > > http://zope.gf.com.br/lalo mailto:[EMAIL PROTECTED] > pgp key: http://zope.gf.com.br/lalo/pessoal/pgp > > Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar > > ___ > 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 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] Streaming?
On Mon, Oct 30, 2000 at 12:48:53PM +1100, Terry Kerr wrote: > That is not streaming. That is just as you said..lack of bandwidth delaying > the entire page arriving at once at you browser. That is not contolled. The > server doesn't send it 'bit by bit' in a controlled manner. But if it did, the results would be exactly the same. Actually, that's exactly what most people refer to when they say "streaming". This is getting way off-topic. I want to know if there is an API for that, not to discuss the meaning of the word. []s, |alo + -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:[EMAIL PROTECTED] pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar ___ 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] Problem with LoginManager, UserSource and object re-mapping
Hi, I have the following setup: - LoginManager with 3 UserSources, one of them named CustomerUserSource. - A Customers specialist, using a Customer ZClass for storage. Customer has a 'login' propertysheet with property 'password', and a getCustomerByName method returning a customer object. - CustomerUserSource 'load by accessing attribute' is set to 'id'. - A SkinScript in CustomerUserSource: WITH Customers.getCustomerByName(Customers, self.id) COMPUTE password=password, original_object=RESULT The following PythonMethod: obj=self.CustomerUserSource.getItem('jane') return obj.password returns the correct password for customer 'jane', but this one: obj=self.getItem('jane') return obj.password returns this: NameError password Troubleshooting Suggestions This resource may be trying to reference a nonexistent object or variable password. The URL may be incorrect. The parameters passed to this resource may be incorrect. If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, line 187, in publish File /opt/Zope-2.2.2-linux2-x86/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: ProviderContainer) File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, line 171, in publish File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: test3) File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: test3) File /opt/Zope/lib/python/Products/PythonMethod/PythonMethod.py, line 168, in __call__ (Object: test3) (Info: ((, ), {}, None)) File , line 8, in test3 (Object: ProviderContainer) File /opt/Zope/lib/python/Products/ZPatterns/DataSkins.py, line 181, in __get_attr__ (Object: BetterLocalRolesMixin) File /opt/Zope/lib/python/Products/ZPatterns/AttributeProviders.py, line 346, in _AttributeFor (Object: GAPMixin) File /opt/Zope/lib/python/Products/ZPatterns/AttributeProviders.py, line 335, in _AttributeFor (Object: GAPMixin) File /opt/Zope/lib/python/Products/ZPatterns/Expressions.py, line 122, in eval File /opt/Zope-2.2.2-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval (Object: password) (Info: password) File , line 0, in ? NameError: (see above) I don't understand why a direct getItem() call to CustomerUserSource would trigger the WITH...COMPUTE line, while just doing getItem() on the LoginManager doesn't? As I understand it, getItem() calls each UserSource, so why would there be a difference in behavior? TIA, Itai -- Itai Tavor"Je sautille, donc je suis." C3Works[EMAIL PROTECTED] - Kermit the Frog "If you haven't got your health, you haven't got anything" ___ 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] Streaming?
Never mind, I found it. Just for the record, if anyone else needs this: The class HTTPResponse (in ZPublisher/HTTPResponse.py) has a "write" method. When you're publishing to the web, the RESPONSE object is an instance of this class. def write(self,data): """\ Return data as a stream HTML data may be returned using a stream-oriented interface. This allows the browser to display partial results while computation of a response to proceed. The published object should first set any output headers or cookies on the response object. Note that published objects must not generate any errors after beginning stream-oriented output. """ I don't know if this is documented somewhere, but it does what I wanted. On Sun, Oct 29, 2000 at 11:05:25PM -0200, Lalo Martins wrote: > Is it possible to "stream" (send data to the client via HTTP > incrementally) from Python code, or does ZPublisher only send > the data as a single wad when the method returns? > > Assuming it is possible, obviously it requires using some other > API rather than just 'return'ing a string... where can I find > documentation and/or examples on that? If there is no existing > documentation or examples, source code would do. > > (Context: when the tests are running on ZUnit, I'd like to give > some visual feedback, if possible by sending the dots returning > by PyUnit in real-time) []s, |alo + -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:[EMAIL PROTECTED] pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar ___ 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 )