IRC logs of #tryton for Monday, 2011-12-05 #tryton log beginning Mon Dec 5 00:00:01 CET 2011
cjbarnes18cedk: re issue2313,  I think this issue is really 2,  1st concern is that the error is not clear.  I had to mute each field to find that time was the problem.00:07
cjbarnes18cedk: 2nd is the obvious missing widget.00:08
cjbarnes18I dont have a use case for this I am simply trying everything out.00:08
cjbarnes18cedk: I have found more missing  on tree views.00:09
cedkcjbarnes18: yes of course, all fields are not displayable in all views00:09
cjbarnes18would a not_supported_in_view+exception be in order do you think?00:11
cedkcjbarnes18: why not00:31
cjbarnes18cedk: ok will add this to the list,  Am happy to attempt both if thats OK,00:34
grasbauersomeone with a shopping cart connected to tryton? how you handle the gross price shown to the client? Mostly in onlineshops there are products with a gross price - not untaxed list_prices .... still thinking about the best way to handle this ...13:56
cedkgrasbauer: I think you must store on the product the gross price13:58
cedkgrasbauer: and of course you can not use sale module13:59
zxq9Does anyone remember how to place an image into a report from a binary field in the database?13:59
grasbauerzxq9: widget="image"14:00
zxq9Into a report, not view.14:00
zxq9Like in an ODT14:00
zxq9I'm trying to follow the Relatorio and Genshi docs, but I'm getting problems.14:01
zxq9Like insert Frame with "image: (model.fieldname, 'image/jpeg')" and getting errors like "'buffer' object has no attribute 'seek'" after tries
cedkzxq9: must convert it into str14:03
zxq9image: ('model.fieldname', 'image/jpeg') ? Because that doesn't work, either. I then get "'str' object has no attribute 'seek'"14:04
cedkzxq9: oops, yes you must use a StringIO14:05
grasbauerzxq9: i did it with a method that creates StringIO.StringIO() from the data14:07
zxq9How did you do that?14:09
grasbauerzxq9: one moment14:09
zxq9You mean define a method in the model that I can call from the ODT which returns the correct ('image', 'mimetype')?14:09
grasbauerzxq9: yes14:10
zxq9I'm not familiar enough with Python data operations to do that without reading an example, I think.14:11
cedkI think we must improve relatorio to work also with str/buffer14:13
zxq9If we could declare mutable variables in Relatorio instead of instance constants that would be very helpful. Arbitrary loops (like a "while" with an arbitrary closing condition) would be very useful too and sort of complete the mini-language.14:15
zxq9At the moment with no mutable variables the only way to create an iterator is to make a list object and list.append(1) and test len(), which is really silly.14:16
cedkzxq9: I think it is a bad practice to put code in templates14:18
zxq9cedk: It is, but we are already doing it when we use <for each="foo in bar">.14:18
zxq9cedk: Its a stupid idea to code inside a web page, but that is what people are doing also -- and that's not much different than coding in templates.14:19
cedkzxq9: it is quite different to have a loop and having a full assignation14:19
zxq9cedk: Having conditionals is great, and having for each is great, but it doesn't work when you have set-length forms instead of things like invoice forms that are allowed to grow longer with each item.14:19
cedkzxq9: as you say it is stupid so don't encourage it14:19
zxq9cedk: But its the only way to do things like properly paginate when you have a government form you must fill out which will be rejected if altered -- and it always has 20 rows, but you have 43 people, so you need 3 pages, 20 + 20 + 3.14:20
cedkzxq9: no, as I already told you you must fix it on the report code14:20
zxq9cedk: I know. And I agree. But people have bosses.14:21
zxq9cedk: I have had to finish this ridiculous project, writing in really crazy Relatorio code inside the report documents.14:21
zxq9cedk: But now... now I can make another version, with the code in a module that goes with the report, and demonstrate how that is better.14:22
cedkzxq9: relatorio doesn't have a boss so we do only good practice14:22
zxq9cedk: But without having done all this crazy Relatorio stuff I couldn't have gotten this far to even begin the argument.14:22
zxq9cedk: If you want people with full time employees and money to start showing up you're going to have to be a little more accomodating than that.14:22
zxq9cedk: The same thing with the language thing VS languages with multiple scripts. I tried doing the translation thing, by the way, but calling setLang() doesn't work beyond multiple calls in a document -- so you can't use it per-field for more than a single field (and we had hundreds).14:24
cedkzxq9: I don't care, I don't want to maintain crappy software14:24
zxq9cedk: And the multiple languages was really confusing for the customer, because there are really a lot of fields where you have to write several alphabet types. :-(14:24
cedkzxq9: this is the last time I said, you must *write code in report parser*14:25
zxq9cedk: I don't think having mutable variables and while() in Relatorio makes it crappy. I think it just completes it14:25
cedkzxq9: no template are not for programming !!!14:25
cedkzxq9: no template are not for programming !!!14:25
zxq9cedk: Then what is <if test=""> in there fore?14:26
zxq9cedk: We should remove it?14:26
cedkzxq9: this is not assignation !!!14:26
zxq9cedk: What is <with vars=""> for?14:26
cedkzxq9: comes from Genshi and it should not be used14:26
zxq9cedk: I think it would be more straightforward to be more strict then... like maybe ONLY allow calls to methods and objects inside models.14:27
zxq9cedk: Then there would be no choice, and everything would still be codable, just only inside the Python code.14:27
zxq9cedk: I don't think this is a bad way, really, so long as a few more tutorials are available/updated.14:28
cedkzxq9: I did not decide to include with but for sure it was a mistake14:28
zxq9cedk: So your vision is Relatorio dropping <with vars="">, and gaining the ability to work directly with for images?14:30
zxq9cedk: I dont think that is a bad thing, it just needs to be documented well.14:30
zxq9cedk: And maybe that means really splitting the Relatorio documentation away from constant Genshi references.14:31
cedkzxq9: patch is welcome14:31
zxq9cedk: How about documentation as well? How do I help with making Relatorio docs up to date?14:32
cedkzxq9: write it14:33
zxq9cedk: Who do I submit to?14:33
cedkzxq9: bugtracker14:33
zxq9cedk: OK.14:33
zxq9cedk: Next question, technical one this time -- how do I know which ids to pass to a fields.Function()? Is it usually a pyson thing?14:34
cedkzxq9: I don't understand14:37
zxq9Like in a getter(ids, name), where does ids get passed from?14:42
cedkzxq9: it comes from the records you are reading14:44
zxq9Ah... ok. This makes more sense now. It was sort of magic to me before -- which is a little scary.14:49
zxq9cedk: Hmmm... I'm trying to take the image data from the binary field and save it as /tmp/image.jpeg, define a file object and return it and the mime type in a function.15:52
zxq9cedk: Am I going in the correct direction or is this wrong to pass an image to a report?15:52
cedkzxq9: yes it looks like16:01
zxq9I'm having a 'char buffer type not available' problem, but I think there is a way to avoid this.16:07
zxq9I think the way I'm calling the method is actually pulling the data as a string from the server, then passing the whole thing as an argument to the method.16:08
zxq9I want to just call the method and have it copy the correct image from the current id into a file.16:08
zxq9And this is where I'm lost on the id thing.16:10
zxq9cedk: and is what is there now, but this is pulling the file data from server to client and pushing it back to write to a file to send again, I think (ridiculous).16:16
zxq9cedk: The binary field face_pic should just get copied once on the server side, but I don't know how to access just the current record from within a method like this.16:17
zxq9cedk: and of course the <image:> part is not written like that, it is the name string of a field16:19
cedkzxq9: why not using StringIO?16:19
zxq9You mean like str(binaryfield)?16:20
zxq9Or maybe I don't know about StringIO?16:20
grasbauerzxq9: StringIO.StringIO(string_from_the_binary_field)16:21
zxq9Ah, it is a Python library class? I neefd to rad about it.16:21
zxq9How would this look? ?16:23
zxq9So StringIO is like virtual files or files in core memory?16:25
zxq9That's way faster than making a /tmp file16:25
zxq9Hmm... pic = (StringIO.StringIO(image), 'image/jpeg'); return pic; makes open office think the document is corrupted, which is interesting.16:31
cedkzxq9: have you the last version of relatorio?16:31
zxq9erm... good question. Lemme check.16:32
zxq9cedk: Should this work or am I still doing something silly?16:33
cedkzxq9: it should16:33
cedkzxq9: but we got sometimes buffer exception because StringIO can not work on buffer from psycopg16:34
cedkzxq9: so adding a str conversion is good16:34
zxq9cedk: Like
zxq9No, I get the old str object has no seek method thing again that way. Must not be what you meant.16:36
cedkzxq9: no the other way16:36
zxq9oh... haha. I see.16:37
zxq9cedk: Calling from "image: person.person.get_pic(person.person.face_pic)" now gives a much more promising error: "'module' object is not callable'16:39
cedkzxq9: you can not call method on BrowseRecord16:41
cedkzxq9: the simple way is to put the method in the localcontext of the report parser16:44
zxq9cedk: Is there an example of this I can read? I'm unclear on exactly where the "report parser" is.16:45
zxq9cedk: Weird. With an update to Relatorio this actually works without the method: <image: (StringIO(str(person.person.face_pic)), 'image/jpeg')17:14
zxq9cedk: And thank you for the example. This will be useful for re-writing my crazy document system!17:15
udonocedk: hi, what is the schedule for 2.2.1?18:20
cedkudono: don't know18:21
udonocedk: ok.18:26
-!- grasbauer( has left #tryton19:58

Generated by 2.11.0 by Marius Gedminas - find it at!