IRC log of #zope3-dev for Monday, 2005-06-13

mexiKONso, List takes a value_type arguemnt00:00
mexiKONChoice takes a vocabulary  or values argument00:00
mexiKONthey mean different things00:00
*** yota has joined #zope3-dev00:11
roymmexiKON, I guess not working from an example is a bit hard for me; I managed to get it working with the "values" argument.00:14
roymWhen I give it a vocabulary argument - I get00:15
roym |  File "/usr/local/Zope3/src/zope/app/form/browser/", line 115, in textForValue00:15
roym |    return term.token00:15
roym |  AttributeError: 'unicode' object has no attribute 'token'00:15
roymMy Vocabulary is basically created using SimpleVocabulary.fromValues([list of values]) - is the wrong thing to use here?00:17
*** drzoltron has quit IRC00:17
*** hazmat has quit IRC00:19
*** timte has quit IRC00:30
mexiKONroym, that really depends on your application00:31
mexiKONwhat are you trying to accomplish?00:31
roymmexiKON, I am trying to use a list of values that is dynamic (for the Choice).00:38
roymAm I missing the point or does SimpleVocabulary not create a vocabulary appropriate00:39
roymfor the RadioWidget?00:39
mexiKONSimpleVocabulary is ok for small vocabularies00:39
mexiKONand it works with the RAdioWidget00:39
mexiKONif hxDxTx is an attribute whose value can be a definite one chosen out of a limited set of values, then the Choice field with a vocabulary (e.g. a SimpleVocabulary) is the way to go00:40
roymAll else being equal, all I did was swap the lines00:41
roym        #vocabulary="hx/dx/tx"00:41
roym        values=["Hx", "Dx", "Tx"]00:41
roymand I get the error aforementioned.00:41
roymif its any use mentioning, the same vocabulary generation code works with the List widgets.00:42
* mexiKON is confused00:44
roymmexiKON, sorry - didn't get that?00:44
roymie: SimpleVocabulary.fromValues([list of values]) produces a vocabulary that is consumed ok by List widgets.00:45
mexiKONlist widgets have nothing to do with vocabularies00:46
roymok - my ignorance shows00:46
roymI have code as follows00:47
roym |     organSystems = List(00:47
roym |         title=u"OrganSystems",00:47
roym |         description=u"List of possible organ systems for this question.",00:47
roym |         required=False,00:47
roym |         unique=True,00:47
roym |         value_type=Choice(title=u"OrganSystems", vocabulary="all organ systems")00:47
roym |         )00:47
mexiKONthis is a list of choices00:47
mexiKONgo on00:47
roymisn't this a consumer of a vocabulary? (in the value_type attribute)00:48
mexiKONthe Choice field is00:48
mexiKONit happens to be the value_type of a List field00:48
roymHow do I do the analogous thing with a Choice?00:49
mexiKONyou don't00:49
roymie: RadioWidget00:49
roymyou had said use either "values" or "vocabulary" - I know how to use the first (and what is brb?)00:50
roymmy impression is that "values" can only be a hardcoded (static) list.00:52
mexiKONbrb = be right back00:53
nederhoedwhere can I find what functions I can call on "context" from within a view?00:53
mexiKONnow i'm back :)00:53
nederhoedI already use "items()"00:53
mexiKONnederhoed, 'context' is the object you're displaying00:53
nederhoedah, ok, in my case it is a container00:53
mexiKONnederhoed, then you can use anything specified in IContainer :)00:53
nederhoedtherefore the items() works, thanks, I'll lookup the IContainer interface00:54
mexiKONroym, ok, here's an example:00:54
nederhoedit's late ... :-)00:54
roymunderstand and thanks for your patience.00:54
mexiKONimagine you go to a grocery store00:54
mexiKONand you have money for exactly 1 one apple00:54
mexiKONso, you need to choose from all the apples there are00:55
mexiKONthat would be:00:55
mexiKONapple = Choice(vocabulary="Apples in grocery store")00:55
mexiKONapple = Choice(values=[apple0, apple1, apple2])00:55
mexiKONthough the latter is only really recommended when apple* are strings00:56
mexiKONnow, the next day you won the lottery00:56
mexiKONand have so much money that you can buy as many apples you like00:56
mexiKONyou go back to the grocery store00:56
mexiKONnow, for simplification, let's imagine that you can buy the same apple more than once00:57
mexiKONbuying a number of apples out of a give set of available apples is:00:57
mexiKONapples = List(value_type=Choice(vocabulary="Apples in grocery store"))00:57
mexiKONnotice the pluraral on apples00:58
mexiKONapples will be a list00:58
mexiKONin the first example, 'apple' was ONE of the apples in the vocabulary00:58
mexiKONnow to forms:00:58
mexiKONthe first example you can render with a dropdown or select widget00:58
roymaha - I see now - I am supposed to still use the value_type argument (I thought i couldn't)00:58
mexiKONsimply select the apple you like to buy00:58
mexiKONthe second one is rendered by using the listsequence widget which in turn renders a radiowidget for each of the apples you buy00:59
nederhoedehm, and if I want to read a given query parameter image ("<view>?image=1") from "self.request"?01:01
nederhoedself.request.get('image') results in an error01:01
roymMaybe I am back to square one :( - here is the incantation I use:01:02
roym | hxDxTx = Choice(01:02
roym |     title=u"HxDxTx",01:02
roym |     description=u"whether in Hx, Dx or Tx",01:02
roym |     required=False,01:02
roym |     value_type=Choice(title=u"HxDxTx", vocabulary="hx/dx/tx"),)01:02
roymand I get the error:01:02
roym | AssertionError: You must specify either values or vocabulary.01:02
roymsorry - I see that I should change the Choice to List.01:03
mexiKONnederhoed, what error?01:04
mexiKONroym, you got it01:04
mexiKONnederhoed, btw, i prefer to use request.form explicitly for GET/POST form values01:05
roymsadly no.01:05
roym | hxDxTx = List(01:05
roym |     title=u"HxDxTx",01:05
roym |     description=u"whether in Hx, Dx or Tx",01:05
roym |     required=False,01:05
roym |     value_type=Choice(title=u"HxDxTx", vocabulary="hx/dx/tx"),)01:05
nederhoedif not self.request.get('image') in self.context.keys():01:05
nederhoed            return result[0]01:05
roymTypeError: Provided field does not provide ICollection.01:05
mexiKONroym, right, you can't use RadioWidget on the List field01:06
nederhoedForbiddenAttribute: ('__contains__', <OOBTreeItems object at 0xb75d7e30>)01:06
mexiKONroym, you want the *subwidget* of the list widget to be the radiowidget01:06
nederhoedI'll try the form now, good idea01:06
nederhoedrequest.form i mean01:07
roymsubwidget? I now use01:07
roym    <widget01:07
roym      field="hxDxTx"01:07
roym      class="" />01:07
mexiKONthat *should* be <widget field="hxDxTx" subwidget="...RadioWidget" />01:07
roymWould I nest another <widget declaration in <widget?01:07
mexiKONof course, sequencewidget is up for that01:07
mexiKONi'll need to fix that in my branch01:08
mexiKONroym, you're covering up some use cases :)01:08
mexiKONanyway, i'll look at this tomorrow or so01:09
mexiKONg'night everyone01:09
nederhoedgood night01:09
roymthanks and g'nite01:09
mexiKONnederhoed, btw, this does look like a problem in BTree security delcarations01:09
mexiKONnederhoed, OOBTreeItems.__contains__ should have security delcarations01:10
mexiKONForbiddenAttribute in code that looks normal is always a sign of missing security delcarations01:10
nederhoed(not that I know what to do now, but its time for bed for me too)01:10
mexiKONnederhoed, well you could ask the list whether is missing security delcarations for ??BTreeItems01:12
mexiKON(?? standing for OO, OI, IO, etc.)01:12
mexiKONIMO adding security delcarations for ??BtreeItems' methods (such as __contains__) would be the answer01:13
*** mexiKON is now known as philiZZZ01:15
nederhoedI thought I may not use .keys(), but should use something like 'has_key'01:15
philiZZZhas_key would be smarter, yes; but .keys().__contains__() should also work01:16
philiZZZto me it looks like you uncovered a bug01:16
nederhoedhum, I'll keep it in mind, for further research: security declarations01:16
philiZZZof course, nobody ever discovered it before you because everyone else uses has_key()01:16
*** philiZZZ is now known as philiZZZZ01:17
nederhoedwhere can I find documentation on what functions I can call on 'request'?01:17
nederhoedby the way, are you in bed alreasy?01:17
philiZZZZuse apidoc to see its members01:17
nederhoedok, I'll manage01:17
philiZZZZi have a laptop and wlan, but i'm not that computer fanatic :)01:17
nederhoedsure ;)01:18
*** philiZZZZ is now known as philiZZZz01:18
nederhoedlike me, I have no laptop, but 2 PCs: xp and fedora, but I'm no fanatic either01:18
nederhoedok, time for bed for me too, cu later, good night!01:18
*** nederhoed has left #zope3-dev01:23
*** projekt01 has joined #zope3-dev02:07
*** yota has quit IRC02:24
*** roym has quit IRC02:37
*** jhauser has quit IRC03:12
*** projekt01 has quit IRC03:42
*** dagnachew has joined #zope3-dev04:14
*** douglasc has joined #zope3-dev04:28
*** douglasc has quit IRC04:34
*** d2m has quit IRC04:49
*** dagnachew has quit IRC05:12
*** xerophyte has quit IRC05:23
*** BjornT has quit IRC06:57
*** zagy has quit IRC08:17
*** hazmat has joined #zope3-dev08:24
bob2hm, File doesn't have .size08:38
bob2need to adapt it to ISized08:40
bob2zope3 is like a massive box of lego08:43
*** zagy has joined #zope3-dev08:48
SteveAbob2: different things need to express their size in different ways08:49
bob2yeah, it makes sense08:50
SteveAbob2: so, ISized exists to give a uniform way of getting the size of a thing, without requiring that everyone take that into account when producing a thing.08:50
SteveAso, you can produce a VideoCollection class that implements a howMany() method, and I can later on provide an ISized adapter for that, without needing commit rights to your SCM system.08:51
bob2hmm, yeah08:51
bob2hrm, are there special rules for what can be adapted?  I naively just made an adapter for a class called Page, and get this:08:52
bob2zope.configuration.config.ConfigurationExecutionError: exceptions.AttributeError: type object 'Page' has no attribute 'weakref'08:52
bob2oh, heh, SteveA filed a bug about this08:55
SteveAyou should be able to make an adapter for anything08:58
SteveAin practice, it usually works best to adapt from an interface to an interface, so that the contract is clear.08:59
*** SureshZ has left #zope3-dev09:00
*** zagy has quit IRC09:01
*** jhauser has joined #zope3-dev09:10
*** timte has joined #zope3-dev09:11
*** yota has joined #zope3-dev09:14
*** SureshZ has joined #zope3-dev09:15
*** SureshZ has left #zope3-dev09:15
*** j-w has joined #zope3-dev09:17
*** sashav_ has joined #zope3-dev09:33
bob2where should I be looking if the Add form for an object displays a Choice attribute, but the Edit page doesn't?09:50
bob2(the other attributes are modifiable on the Edit page)09:50
*** BjornT has joined #zope3-dev09:59
SteveAaw poo.  i can't make a list object directly provide an interface10:02
*** guido_g has joined #zope3-dev10:05
j-wbob2: does the 'field' attribute for the editForm directive list this particular Choice field?10:11
j-wbob2: you're welcome, just glad I could help instead of ask for once :)10:15
*** guido_g has quit IRC10:17
*** douglasc has joined #zope3-dev10:24
*** guido_g has joined #zope3-dev10:25
bob2how do I register a utility?10:37
bob2hm, that seems to the wrong question10:39
bob2I'm trying to register an adapter from to another class, to catch ftp uploads of a certain type10:40
*** hazmat has quit IRC10:54
bob2it seems not actually be registered11:05
*** jhauser_ has joined #zope3-dev11:15
*** zagy has joined #zope3-dev11:22
*** mexiKON has joined #zope3-dev11:23
*** SteveA has quit IRC11:25
*** jhauser has quit IRC11:27
*** philiZZZz has quit IRC11:31
*** __gotcha_ has joined #zope3-dev11:44
*** SteveA has joined #zope3-dev11:44
*** __gotcha_ is now known as __gotcha11:44
*** povbot has joined #zope3-dev12:26
*** d2m has joined #zope3-dev12:27
*** drzoltron has joined #zope3-dev12:31
drzoltronsqlos: did anyone try fields with many-to-many relationships ?12:33
*** apoirier has joined #zope3-dev12:33
*** povbot` has quit IRC12:43
*** J1m has joined #zope3-dev13:03
*** SteveA has quit IRC13:24
*** bskahan has joined #zope3-dev13:39
*** SteveA has joined #zope3-dev13:41
*** ignas has joined #zope3-dev13:43
*** mgedmin has joined #zope3-dev13:54
J1msrichter, ayt?13:58
*** bskahan has quit IRC14:02
*** faassen has joined #zope3-dev14:03
drzoltronif my type / class had an attribute foo how would I get only the attribute  ?14:04
drzoltronhttp://xxxxx.xxxxx.xxxx/class/foo does not do it ...14:04
J1mI have no idea what you are talking about.14:05
drzoltronin zope2 you could get a field of the schema by adding it to the URL14:06 would return the field's value14:06
drzoltronin Z3 I get errors14:07
J1mZ3 doesn't publish content attributes by default.14:07
J1mYou have to use views.14:07
drzoltronmakes it hard to debug14:07
J1mRead the tutorial or one of the books.14:07
drzoltronactually reading stephan's right now :)14:08
drzoltronJim, do you have experience with sqlos and many-to-many relationships ?14:09
*** bskahan has joined #zope3-dev14:14
*** SteveA has quit IRC14:16
drzoltronthanx Jim, view written :)14:21
*** SteveA has joined #zope3-dev14:35
drzoltronHow do I do a zLOG() in Z3 ?14:35
J1mUse the standard Python logger14:42
*** projekt01 has joined #zope3-dev14:44
*** SteveA has quit IRC14:49
drzoltronJ1M. of course ...14:49
*** bskahan has quit IRC15:00
*** bskahan has joined #zope3-dev15:03
*** SteveA has joined #zope3-dev15:08
*** J1m has quit IRC15:14
*** tvon has joined #zope3-dev15:25
*** srichter has quit IRC15:31
*** srichter has joined #zope3-dev15:35
*** ChanServ sets mode: +o srichter15:35
*** guido_g has quit IRC15:53
*** whit537 has joined #zope3-dev15:59
*** niemeyer has joined #zope3-dev16:01
*** niemeyer_ has joined #zope3-dev16:06
*** SteveA has quit IRC16:06
*** apoirier has quit IRC16:06
*** bradb has joined #zope3-dev16:08
*** niemeyer has quit IRC16:10
*** gintas has joined #zope3-dev16:24
*** SteveA has joined #zope3-dev16:25
*** SureshZ has joined #zope3-dev16:34
*** jhauser_ has quit IRC16:39
*** jhauser has joined #zope3-dev16:47
*** J1m has joined #zope3-dev16:52
*** d2m has quit IRC17:04
*** tvon|x31 has joined #zope3-dev17:07
*** benji_york has joined #zope3-dev17:15
*** regebro has quit IRC17:55
*** drzoltron has quit IRC18:00
*** sashav_ has quit IRC18:06
*** __gotcha has quit IRC18:26
*** roym has joined #zope3-dev18:29
*** regebro has joined #zope3-dev18:34
regebroAha.... I for the first time encountered untrusted python code in Zope3! :)18:34
regebroThe "filter" settings on menues are seen as untrusted.18:35
regebroAnd, not unexpected, trying the expression fails with a ForbiddenAttribute....18:35
regebroI couldn't find out how you make a method publicly accessible. Schemas, yes, views, yes, methods, nope...18:36
*** jhauser has quit IRC18:36
regebro(It's Five, but using security.declarePublic didn't work, but I expected that).18:38
J1mIn Z3, you require the permission zope.Public, or use the allow directive rather than require.18:39
regebroOK, I'll try that.18:42
*** Theuni has quit IRC18:42
*** hazmat has joined #zope3-dev18:58
*** SteveA has quit IRC19:09
*** hazmat has quit IRC19:12
*** suresh has joined #zope3-dev19:14
*** j-w has quit IRC19:19
*** Theuni has joined #zope3-dev19:23
regebroDamn, Five has now "allow" or "require" directives, and implementing them turns out to be harder than I thought.19:24
regebro 'ConfigurationMachine' object has no attribute 'module'19:25
*** SteveA has joined #zope3-dev19:28
regebroHm. Do allow and require even work in 3.0.0? They seem to be the only directives ever using the module attribute, and there doesn't seem to be one...19:29
*** SureshZ has quit IRC19:29
J1mAre you talking about z3 or Five?19:30
regebroOr rather, allow and require does not work in Five, because they are not implemented. :)19:31
regebroSo I tried, but failed. But the question above if allow and require work is for
regebroz3, that is.19:31
mexiKONregebro, that's not true19:32
mexiKONregebro, both allow and require work19:32
mexiKONregebro, that's actually a major idea of Five: taking security delcarations out of zope2 code19:32
J1mNote that allow and require work in either a module directive or a class directive19:33
mexiKONJ1m, Five has its own content (==class) directive19:33
mexiKONJ1m, it provides a z3 way of making z2 security assertions19:34
mexiKONthe spelling is ZCML, the effect is the same of ClassSecurityInfo()19:34
regebroAh, so it should be used as a subdirective only?19:34
mexiKONyup; there's no allow and require top-level directive in z3 either19:34
*** tvon has quit IRC19:35
regebroIt has an allow and a require directive.19:36
regebroWhich I assume only work under the "groupingDirective"?19:36
mexiKONah, right19:36
mexiKONthat's the module-based allow and require19:37
mexiKON<configure module="..."><allow ... /></configure> i guess19:37
regebroThat wasn't very obvious. :)19:37
regebroIt wasn't obvious from the source, that is.19:37
mexiKONand now i remember why i didn't cover it in my book ;)19:38
regebroOK, so, then the problem is that there is no "module" support in Five as far as I can see.19:39
regebroMaybe I can just pretend that my non-content class is a content class. Hmmm.19:39
J1mmexiKON, I think you mean: <module module="...">19:39
mexiKONJ1m, uh, right19:39
mexiKONregebro, <content> is just the name of the directive19:39
mexiKONyes, it suggests you're dealing with content19:39
mexiKONbut it's there to make security assertions about any kind of class that needs them19:40
J1mYou can also use <class class="...">19:40
mexiKONwhich is why there exists an alias for that directive, <class>, to make that clearer19:40
mexiKONright, <content> and <class> are the same in every respect19:40
mexiKONjust a different name19:40
regebroOh, I didn't know that.19:40
mexiKONutilities, adapters, and view classes typically don't need their own security assertions; the security is provided when registering the respective component19:42
mexiKONexception: trusted adapters19:42
mexiKON(browse my book's index for an example of trusted adapters)19:43
mexiKONanother exception: persistent utilities19:43
regebroThats what this is, a persistent utility. (that is, its a portal tool. ;) )19:44
mexiKONthere you go19:45
regebroOK, no class in Five, but content passed. Didn't help though...19:45
mexiKONwe should add the 'class' alias :)19:45
mexiKONregebro, let's head over to #z3-base19:45
*** zagy has quit IRC19:48
*** hazmat has joined #zope3-dev19:50
*** zagy has joined #zope3-dev19:53
*** regebro has quit IRC19:53
*** SteveA_ has joined #zope3-dev19:56
*** jhauser has joined #zope3-dev20:11
*** SteveA has quit IRC20:13
*** tarek has joined #zope3-dev20:19
mgedminI have a question about ZODB transactions20:19
mgedminsuppose there are two objects, a and b20:19
mgedminb is a BTreeContainer20:19
mgedmintransaction 1 changes an attribute of a and iterates over b, changing attributes of the objects contained therein20:20
mgedmintransaction b reads the same attribute of a, and adds a new object to b20:20
mgedminwould these two transactions conflict?20:21
mgedminthat's not good20:22
J1mwhy not?20:22
mgedminI have an invariant in my system: when a.approved is not None, then all subobjects in the list b are in a certain state20:22
mgedminthe view that adds new items to the list checks the attribute to see whether it can do so or not20:22
mgedminhow can I achieve an atomic state transition then?20:24
*** gintas has quit IRC20:24
mgedminlist-not-frozen -> list-frozen20:24
mgedmindo I have to introduce a third state (list-being-frozen-now) and commit in the middle?20:25
* J1m thinking20:25
SteveA_make transaction b actually write the same value it read back to a20:26
SteveA_make writing 'a" a condition of changing the btree b20:26
SteveA_and, but both behind a single API so that callers don't have to do the remembering20:27
mgedminSteveA_, thanks20:28
J1mI'm trying to think of a scenario where you can get into trouble.20:29
J1mOh, never mind20:29
J1mThis is an interesting case20:30
J1mI'll have to ponder it.20:32
*** niemeyer_ is now known as niemeyer20:41
*** faassen has quit IRC20:44
*** jhauser has quit IRC20:49
*** roym` has joined #zope3-dev21:08
*** roym has quit IRC21:08
*** roym`` has joined #zope3-dev21:16
*** roym` has quit IRC21:16
*** zagy has quit IRC21:18
*** tarek has quit IRC21:22
*** RaFromBRC has joined #zope3-dev21:32
*** timte has quit IRC21:36
*** Aiste has joined #zope3-dev21:50
*** alga has joined #zope3-dev21:57
*** mgedmin has quit IRC22:04
*** alga has quit IRC22:05
*** nederhoed has joined #zope3-dev22:19
*** SteveA__ has joined #zope3-dev22:21
*** SteveA__ is now known as SteveA22:22
*** Aiste has quit IRC22:25
*** niemeyer has quit IRC22:28
nederhoedquestion, how can I prevent from my ZMI being shown in my freshly developed skin?22:31
*** niemeyer has joined #zope3-dev22:32
nederhoedcan I enforce it also by config?22:33
nederhoedI use zope.View for my skin, that is not correct is it?22:36
nederhoedas permission I mean22:36
*** jhauser has joined #zope3-dev22:37
nederhoedah... thank you22:39
benji_yorknederhoed: you can set the skin in ZCML with something like this: <browser:skin name="Foo" layers="foo rotterdam default" />22:39
benji_yorkyou can define the layer like this: <browser:layer name="foo" />22:39
nederhoedI did that, benji, but now my ZMI also ends up in my default view22:41
benji_yorkand then you can define views and such that refer to the layer22:42
benji_yorkhmm, by "ZMI also ends up in my default view" what exactly do you mean?22:42
benji_yorkdo you mean a tab that points to @@contents.html?22:43
nederhoedif I view @@contents.html for the site root, it uses my skin, and not all slots have been defined in my skin22:43
nederhoedmy skin I mean22:43
benji_yorkdo you want a @@contents.html view?22:43
nederhoedhum... I think so22:44
nederhoedthat would suffice indeed22:44
benji_yorkwhen you defined your view did you leave the rotterdam level in? (like the <browser:skin> code I posted above?)22:45
nederhoed  <layer name="camperconsult" />22:46
nederhoed  <skin name="camperconsult" layers="camperconsult rotterdam default" />22:46
nederhoedhum I assume this isn't the intention:22:47
nederhoed  <page22:47
nederhoed    for="*"22:47
nederhoed    name="skin_macros"22:47
nederhoed    permission="zope.View"22:47
nederhoed    layer="camperconsult"22:47
nederhoed    template="" />22:47
*** SteveA_ has quit IRC22:47
benji_yorkThat should work, but you should define all the slots, I don't know of a way to "inherit" them from the other skins22:48
nederhoedok I'll try that22:49
nederhoedI'm following Stephan's book chap 24, btw22:50
benji_yorkgood, I've read a bit of it and it seems quite well written22:54
nederhoedyes, it's very valuable. I have read (and own) philipp's book also :)22:56
*** ignas has quit IRC23:07
*** tarek has joined #zope3-dev23:19
*** SteveA has quit IRC23:22
*** nederhoed has quit IRC23:40
*** SteveA has joined #zope3-dev23:41
*** tvon has joined #zope3-dev23:43

Generated by 2.15.1 by Marius Gedminas - find it at!