*** ignas has joined #schooltool | 00:10 | |
*** Aiste_ is now known as Aiste | 00:44 | |
*** didymo has quit IRC | 01:10 | |
*** ignas has quit IRC | 02:33 | |
*** wrobel has quit IRC | 04:53 | |
*** wrobel has joined #schooltool | 04:54 | |
*** Aiste has quit IRC | 08:16 | |
*** th1a has joined #schooltool | 08:28 | |
*** th1a has quit IRC | 10:31 | |
*** Aiste has joined #schooltool | 11:58 | |
*** ignas has joined #schooltool | 14:58 | |
*** ignas has quit IRC | 14:58 | |
*** jinty has joined #schooltool | 15:15 | |
*** ignas has joined #schooltool | 15:16 | |
*** ignas has quit IRC | 15:19 | |
*** jelkner has joined #schooltool | 15:33 | |
jelkner | srichter: good morning stephan | 15:34 |
---|---|---|
*** ignas has joined #schooltool | 15:37 | |
*** ignas has quit IRC | 15:37 | |
*** ignas has joined #schooltool | 15:55 | |
*** ignas has quit IRC | 15:56 | |
tiredbones | jelkner, how was pycon? | 15:59 |
jelkner | tiredbones: i'm still here | 16:06 |
jelkner | but friday and saturday were great | 16:06 |
jelkner | jim fulton's "state of zope" talk was very helpful | 16:07 |
jelkner | i'm going to miss the morning sessions today to attend class | 16:08 |
tiredbones | jelkner, I'm glade you are enjoying yourself. | 16:08 |
tiredbones | jelkner, I'm glade you are enjoying yourself. | 16:08 |
tiredbones | jelkner, Speaking of class, what time does it start/ | 16:08 |
jelkner | in 2 hours | 16:09 |
jelkner | less 9 minutes ;-) | 16:09 |
tiredbones | jelkner, what part of jim's speach did you like/ | 16:09 |
jelkner | tiredbones: it was most interesting to get a sense of jim's thoughts on zope3 and zope2, and what they are, who they are for, and where they are going | 16:11 |
jelkner | i never really understood the extent to which in moving to support Python programers (zope2 was never really aimed at Python programmers), zope3 has largely abandoned zope's original audience | 16:13 |
*** ignas has joined #schooltool | 16:13 | |
jelkner | jim called zope2 the "ruby on rails of it's time" | 16:13 |
jelkner | it was aimed at user's, content managers, and through the web developers | 16:14 |
jelkner | zope3 has an entirely different audience in mind | 16:14 |
jelkner | so there are real questions as to which way forward is best. | 16:14 |
jelkner | should zope2 and zope3 eventually merge? | 16:15 |
tiredbones | jelkner, what audience do you think zope 3 is intended for? | 16:15 |
jelkner | zope3 was designed by and written for programmers | 16:16 |
tiredbones | jelkner, but zope 2 was designed by and written for programmers. So it seems same goal to me. | 16:17 |
tiredbones | jelkner, it will be interesting to read his speach. | 16:18 |
jelkner | not according to jim | 16:19 |
jelkner | and many python programmers complained about how difficult it was to use zope2 the way they wanted | 16:19 |
jelkner | that was the motivation for zope3 in the first place | 16:20 |
tiredbones | jelkner, nothing change there, the learning curve is still sharp. | 16:20 |
jelkner | that's true, but once you rap your head around (or so i've been told, since i don't know from person experience ;-), zope3 is much friendlier to programmers | 16:23 |
tiredbones | jelkner, I'm counting on it! | 16:23 |
jelkner | let's see how this class runs | 16:23 |
jelkner | ok, i need to do a bit of studying before class, i'll be back in an hour... | 16:24 |
srichter | jelkner: good morning | 16:40 |
*** ignas has quit IRC | 16:47 | |
*** ignas has joined #schooltool | 16:51 | |
jelkner | srichter: pycon has been good (like always) again this year | 16:53 |
jelkner | jim thanked you several times for the work you have been doing with zope3 | 16:53 |
jelkner | i was hoping you would be here | 16:54 |
*** flint has joined #schooltool | 17:30 | |
flint | hey jeff | 17:31 |
*** pcardune has joined #schooltool | 17:34 | |
tiredbones | pcardune, can I ask you a question on IContainer and IContained? | 17:35 |
pcardune | tiredbones: yep | 17:36 |
flint | hey paul. got an account on maddog. | 17:36 |
tiredbones | pcardune, IContainer is used to specify that we want to store an object, does IContained used to conter what object can be stored? | 17:37 |
pcardune | IContained defines what kind of container an object can be stored in | 17:38 |
pcardune | It will become clearer in our implementation | 17:38 |
tiredbones | pcardune, that's what I thought. | 17:39 |
tiredbones | pcardune, If that is so, then why define what object can be contain with IContainer? | 17:40 |
tiredbones | pcardune, It seems they both do the same thing. | 17:40 |
tiredbones | pcardune, Only in s different way. | 17:41 |
pcardune | because there are some cases when you want to put an object into a container that doesn't have any constraints on what it contains (like a Folder container) | 17:42 |
pcardune | You can't change the constraints on the Folder container (adding your object to the list of objects it can contain) so instead you have to define the constraint with IContained | 17:43 |
pcardune | it's true that for this example it doesn't seem entirely necessary, but it is just the standard pattern used in Zope | 17:43 |
pcardune | flint: did you get my email(s) | 17:44 |
tiredbones | pcardune, So if we define an IContainer and we then want to add an object that we did not make an ICOntainer for we would use IContained? | 17:44 |
flint | pcardune, paul, they were very helpful. Did you get mine from last night? | 17:44 |
pcardune | flint: yes, did you get my response to the ones from last night? | 17:45 |
flint | pcardune, the discussion I had with Jeff this morning lead to an account on maddog. I will check this morning. BTW it is 08:00 in the AM where you are! | 17:45 |
flint | pcardune, whatever you are getting for this it is not worth gettting up THAT early! :^) | 17:46 |
pcardune | tiredbones: no, rather if used an IContainer that we didn't make, (one that where we cant change the code), then we would make an IContained for the objects we want to put in that container (assuming there are no constraints on the IContainer that we are using) | 17:46 |
* tiredbones thinks about that! | 17:47 | |
pcardune | flint: I like having to get up early, because when the class is over, I'm still up earlier than I normally would be, which means I have a longer day and more time to do stuff. | 17:47 |
jelkner | pcardune: where are you? | 17:48 |
jelkner | i just tried to call, but i got an answering machine | 17:48 |
pcardune | jelkner: I'm in another room | 17:49 |
*** Yuy has joined #schooltool | 17:49 | |
pcardune | jelkner: with more light, and more space to work | 17:49 |
jelkner | good morning, linda! | 17:49 |
Yuy | morning | 17:49 |
tiredbones | pcardune, those constraints would be define by ItemTypePrecondition | 17:49 |
Yuy | class won't start for 10 minutes | 17:49 |
flint | Yuy, good morning linda. | 17:49 |
Yuy | hello, teacher | 17:50 |
pcardune | hi linda | 17:50 |
tiredbones | pcardune, I thought I get my question out of the way so that I would bother the class. | 17:50 |
pcardune | tiredbones: the ItemTypePrecondition is for the Container, not the object being contained | 17:51 |
flint | pcardune, I will try the final path suggestion you have. Elkner I am not pathing correctly on maddog, and the final test from the lesson is not working " ~/zope3/bin/test -vpu --dir timeclock | 17:52 |
flint | " is bombing out on maddog. The python tests.py is working ok. | 17:52 |
flint | jelkner, paul has suggested a fix. I am trying this fix. | 17:53 |
tiredbones | pcardune, ok I see that now. thanks | 17:53 |
flint | pcardune, your final fix fixed all. Things are working. Lets move forward. Thanks for your help one and all! | 17:58 |
pcardune | flint: great | 17:59 |
flint | pcardune, regarding your indecent proclivity of rising early, I feel that quests for moral perfection are best left to the young :^) | 17:59 |
flint | be right back after i get more coffee. | 18:00 |
pcardune | Ok, is everyone that needs to be here, here? | 18:00 |
jelkner | if not, they are late | 18:00 |
jelkner | let's go! ;-) | 18:00 |
pcardune | ok, so last week we wrote our first failing test, along with figuring out how to run tests. | 18:01 |
pcardune | this week , we are going to make that test pass, and write more tests | 18:01 |
*** wdickers has joined #schooltool | 18:01 | |
pcardune | and write the implementation of our IPerson and IPersonContainer interfaces | 18:01 |
wdickers | morning | 18:02 |
pcardune | so, my first suggestion is to rerun the failing test from last week to make sure you still remember how all that stuff works | 18:02 |
pcardune | goodmorning wdickers | 18:02 |
pcardune | pay attention to the error message, and think of how this might be remedied (it is just regular python, and no zope to make this test pass) | 18:03 |
pcardune | once you have made the test pass, come back and say so, or if you dont get it, I will explain it if necessary in a minute | 18:04 |
jelkner | done | 18:05 |
jelkner | Ran 1 tests with 0 failures and 0 errors in 0.031 seconds. | 18:05 |
pcardune | ok jelkner, why don't you tell us what you did to make that test pass | 18:06 |
jelkner | well, the test wanted to import a Person class from a person module | 18:06 |
jelkner | so i created a file named person.py (the person module) | 18:07 |
jelkner | and in that put: | 18:07 |
jelkner | class Person: | 18:07 |
jelkner | pass | 18:07 |
jelkner | that's it | 18:07 |
jelkner | i don't know about docstrings or such | 18:07 |
pcardune | ok, good | 18:07 |
pcardune | (that's right) | 18:07 |
flint | jelkner, I also touched a file called person, and the test failed. how did you know what to put in the file? | 18:08 |
jelkner | it says "from person import Person" | 18:08 |
jelkner | in python capital letters are used for class names | 18:09 |
flint | ok what about "pass"? | 18:09 |
flint | btw it works here as well. | 18:09 |
jelkner | i'm not sure pass was the right thing to do, but the class had to have a body | 18:09 |
pcardune | flint: the class doesn't need to do anything other than exist, so we just write pass to say "move along... there is nothing to see here" | 18:10 |
jelkner | pass is just a place holder when you don't know waht to put | 18:10 |
pcardune | so, the next step is to write the next test | 18:10 |
flint | pcardune, is "pass" bette syntax than say "move along... there is nothing to see here" or maybe banana? | 18:10 |
pcardune | flint: pass is python | 18:10 |
pcardune | it is a python keyword | 18:10 |
jelkner | yuy, wdickers, did it work for you? | 18:10 |
Yuy | we're creating a person.py file now? | 18:11 |
wdickers | Yes, it worked | 18:11 |
pcardune | yes, please follow the solution that jelkner posted for making the test pass | 18:11 |
flint | pcardune, i have checked pass is not optional. The module fails without it. | 18:12 |
pcardune | flint: right, like jelkner said, every class needs a body... if you don't want the body to do anything, you write "pass" | 18:12 |
flint | pcardune, that I did not know thanks. | 18:13 |
pcardune | there always has to be something after a ':' in python, so you can also see pass statements after, loops, conditionals, function definitions, etc. | 18:13 |
pcardune | so moving on | 18:13 |
pcardune | the next thing we want to do in our README.txt file (please open that up), is to create an instance of this Person object we made | 18:13 |
flint | pcardune, a comment will not work. it must be a keyword other than a comment eh | 18:13 |
pcardune | flint: yes | 18:14 |
pcardune | just like regular python, you might want to write ">>> worker = Person()" | 18:14 |
pcardune | Here I have just come up with an arbitrary variable "worker" that relates slightly to the context of timeclock (since we are dealing with workers) but otherwise it is totally arbitrary | 18:15 |
jelkner | we could use a docstring instead of pass, yes? | 18:15 |
jelkner | which is the zope way of doing things? | 18:15 |
flint | where do we put this? The beginning seems like a bad place, the end seems not right. What about before the "cool" line? | 18:16 |
* tiredbones used ">>>Consultant = Person()" | 18:17 | |
pcardune | flint: yes, before the cool line, in fact, you can even delete the cool line because we wont need that | 18:17 |
pcardune | tiredbones: use all lowercase for the variable... ">>> consultant = Person()" would be the standard way | 18:17 |
flint | tiredbones, as a consultant I would challange the verasity of this statement. consultants are not people, ever eaten with one?:^) | 18:17 |
pcardune | jelkner: we can't use a docstring on a class because python doesn't like that, we can do it on class methods though | 18:18 |
wdickers | what "cool" line is this? I don't see one in README | 18:18 |
pcardune | wdickers: it was on the README from the wiki | 18:18 |
jelkner | nor i | 18:18 |
pcardune | or in the README that I sent out to everyone | 18:19 |
flint | pcardune, it was README.txt in the tarball. | 18:19 |
pcardune | don't worry about, it was superfluous | 18:19 |
pcardune | after creating our object, we want to make sure it implements the IPerson interface | 18:19 |
flint | pcardune, yet it hurts nothing to leave it there? | 18:19 |
pcardune | flint: nope, that test will always pass | 18:20 |
flint | pcardune, gotcha | 18:20 |
jelkner | http://ypal.net/zope3class/READMETxt | 18:20 |
jelkner | should look like this now | 18:20 |
pcardune | to do this, in README.txt add the line ">>> from timeclock import interfaces" either just below, or after importing Person | 18:21 |
pcardune | this gives us access to all the stuff we defined in interfaces.py | 18:21 |
flint | pcardune, and it still passes the test process. | 18:23 |
pcardune | flint: as it should, we already made the interfaces.py file | 18:23 |
pcardune | now, the way you check to see if an object implements a certain interface, you use the providedBy method | 18:23 |
pcardune | so add this line to the bottom of the test | 18:24 |
pcardune | >>> interfaces.IPerson.providedBy(worker) | 18:24 |
pcardune | and then a "True" right after that | 18:25 |
pcardune | it should look like: | 18:25 |
pcardune | >>> interfaces.IPerson.providedBy(worker) | 18:25 |
pcardune | True | 18:25 |
pcardune | as it would look in a python interpreter | 18:25 |
wdickers | wait, when you say 'test'', do you mean tests.py or README.txt? | 18:25 |
jelkner | README.txt | 18:25 |
flint | pcardune, what would happen if you said "true" (note case) | 18:26 |
pcardune | i mean README.txt | 18:26 |
pcardune | flint: True is another python keyword | 18:26 |
pcardune | and case matters | 18:26 |
pcardune | so true would not work | 18:26 |
pcardune | if you run the test, it should fail | 18:27 |
flint | pcardune, it does indeed. | 18:27 |
pcardune | so, this brings us to the concept of "providing" | 18:27 |
pcardune | implementations implement an interface | 18:28 |
pcardune | and objects provide an interface | 18:28 |
pcardune | so an instance of our implementation should provide the interface we want our implementation to implement | 18:29 |
jelkner | say that 3 times quickly! ;-) | 18:29 |
pcardune | yeah, you can use that line to impress people who don't know about the component architecture or zope, like all your non-techie friends (it works every time) | 18:30 |
pcardune | there is also another method you can use to test the Person class, and not just an instance of it | 18:30 |
flint | pcardune, implementation implements an interface | 18:31 |
pcardune | flint: correct | 18:31 |
pcardune | to test the class itself you would write | 18:31 |
pcardune | >>> interfaces.IPerson.implementedBy(Person) | 18:31 |
pcardune | True | 18:31 |
flint | pcardune, you gott watch you 's with this crowd... :^) | 18:31 |
pcardune | flint: ? | 18:31 |
wdickers | why do we use Person instead of Worker? | 18:32 |
wdickers | *worker | 18:32 |
tiredbones | flint, implementation implements what and interface provides | 18:32 |
pcardune | wdickers: implementedBy is for class definitions, interfaces are implemented by a class, so we test the class | 18:32 |
pcardune | instances of a class *provide* the interfaces of the class, so we use providedBy | 18:33 |
wdickers | well wouldn't worker be the same class as Person? Or is worker merely an instance? | 18:33 |
pcardune | worker is merely an instance | 18:33 |
wdickers | ah, okay | 18:33 |
tiredbones | pcardune, Can you also have interface in modules? | 18:33 |
pcardune | so if you wanted to, you could put the implementedBy part before we have defined worker and the test should still pass | 18:34 |
pcardune | tiredbones: I'm not sure I understand your question | 18:34 |
pcardune | so, if everyone has a failing test, lets go make it pass | 18:34 |
pcardune | go back to person.py | 18:35 |
tiredbones | pcardune, Can't interface be provided by a module? | 18:35 |
flint | pcardune, what you said was "implementations implement an interface". What you meant was "implementation implements an interface" the "s" was in the wrong place. | 18:35 |
tiredbones | pcardune, Can't interface be provided by a module instead of a class | 18:35 |
pcardune | make sure you add a docstring to the Person class (something simple like """An implementation of IPerson.""") | 18:35 |
pcardune | tiredbones: no, interfaces are only provided by classes | 18:35 |
pcardune | flint: thank you... that was subtle | 18:36 |
pcardune | now, we are going to want to make a few imports | 18:36 |
flint | pcardune, your welcome, this stuff is subtle. | 18:36 |
pcardune | import the following modules: zope.interface, zope.app.container.contained, interfaces | 18:37 |
pcardune | it is also a convention to separate imports by the modules you are importing them from... so all zope imports go in one place, and all imports from timeclock related stuff goes below that with a line in between | 18:38 |
pcardune | like: | 18:38 |
pcardune | import zope.interface | 18:38 |
pcardune | import zope.app.container.contained | 18:38 |
pcardune | import interfaces | 18:38 |
pcardune | woops... it didn't like my empty line in before "import interfaces"... pretend it is there | 18:38 |
Yuy | and to clarify, this is all in the README.txt fil | 18:39 |
Yuy | s/fil/file | 18:39 |
pcardune | sorry, i didn't mention that we were switching again to the person.py file | 18:39 |
jelkner | yuy: we are working on person.py now, | 18:39 |
Yuy | kk | 18:40 |
pcardune | so the last things i said about imports are in person.py | 18:40 |
wdickers | oh, whoops xD | 18:40 |
*** alga has joined #SchoolTool | 18:41 | |
flint | pcardune, no, you said it "go back to person.py" about 10 lines back. | 18:41 |
pcardune | I am just going to give you the Person class as it should look to pass the test | 18:41 |
pcardune | flint: wow, in that case, even I missed what I had just said | 18:41 |
pcardune | your person.py file should look like http://ypal.net/zope3class/PersonPy | 18:42 |
flint | pcardune, this is what happens when a young man such as yourself gets up too early in the morning :^) | 18:42 |
pcardune | just copy the Person class that is there | 18:42 |
pcardune | flint: small price to pay | 18:42 |
pcardune | let me first call your attention to the "zope.interface.implements(...." line | 18:43 |
tiredbones | Now days anything below 50yrs is young. | 18:43 |
pcardune | this tells zope what this class is supposed to implement | 18:44 |
pcardune | does everyone understand this line? | 18:44 |
pcardune | we just give it a list of interfaces | 18:44 |
Yuy | yes, and it coincides with the 'from timeclock ...' line in the README file | 18:45 |
wdickers | so it implements those classes? | 18:46 |
pcardune | right, so next look out how Person now inherits from zope.app.container.contained.Contained | 18:46 |
pcardune | wdickers: it implements those *interfaces*, but yes you have the right idea | 18:46 |
wdickers | okay | 18:46 |
pcardune | remember that IPersonContained inherited from zope.app.container.interfaces.IContained | 18:47 |
pcardune | fortunately, there is already an implementation of this interface... we just reuse it by having our Person class inherit from that | 18:47 |
pcardune | so, now our Person class is also a zope.app.container.contained.Contained class | 18:48 |
pcardune | which will satisfy the "contract" with IPersonContained | 18:48 |
pcardune | does that make sense to everyone? | 18:48 |
flint | pcardune, No. did it make sense to you? | 18:49 |
pcardune | flint: surprisingly, yes | 18:49 |
flint | pcardune, ok move on. | 18:49 |
jelkner | flint: thanks! ;-) | 18:49 |
pcardune | well, if everyone else is also guessing, then I should stop and make this clearer | 18:49 |
pcardune | jelkner: do you get this? | 18:50 |
jelkner | yes | 18:50 |
flint | pcardune, make elkner write it down. | 18:50 |
pcardune | ok, flint, just read carefully | 18:50 |
wdickers | wait, in the Interfaces from ypal, IPersonContained inherits from Container | 18:50 |
wdickers | **IContainer | 18:50 |
pcardune | really? that must be a type | 18:51 |
pcardune | s/type/typo (the irony) | 18:51 |
pcardune | ok, it is fixed... thanks wdickers for seeing that | 18:52 |
wdickers | welcome | 18:52 |
pcardune | next to satisfy the contract with IPerson, we need to define two attributes to the class | 18:52 |
pcardune | title, and username, as you see done there | 18:52 |
pcardune | please note that they are unicode strings | 18:53 |
wdickers | Why do we use single quotes instead of double like in Interfaces? | 18:53 |
wdickers | **interfaces (stupid caps) | 18:53 |
pcardune | wdickers: its arbitrary, you could use either | 18:54 |
wdickers | okay | 18:54 |
pcardune | so, the attributes are initially just empty, but they are of a type that conforms to how they were defined in the IPerson interface | 18:54 |
pcardune | that is, they are strings (zope.schema.TextLine deals with strings) | 18:55 |
flint | wdickers, so the typo was in interfaces.py? | 18:55 |
pcardune | they also have to be unicode | 18:55 |
wdickers | flint: yes | 18:55 |
pcardune | flint: yes, but i think the typo was just on the wiki | 18:55 |
wdickers | well I kinda copied from the Wiki so.... | 18:55 |
pcardune | the unicode is necessary because when we are creating the a Person object through a web interface, we want the user to be able to enter in any kind of characters, be they letters with accent marks, or chinese characters, or arabic, etc. regular ascii wont do this, we need unicode strings | 18:56 |
pcardune | so, now try running the test, and it should pass | 18:56 |
jelkner | it does | 18:57 |
flint | that is what the "u" is all about? | 18:57 |
jelkner | yes | 18:57 |
pcardune | go back to README.txt | 18:57 |
flint | jelkner, thank you Jeff Typo, er... Elkner. :^) | 18:58 |
pcardune | we forgot to test that Person implements IPersonContained | 18:58 |
flint | pcardune, the test passed. | 18:58 |
pcardune | which is fine, sometimes we write tests after we write the code that makes them pass | 18:59 |
pcardune | you should all know how to add this test by now | 18:59 |
pcardune | your README.txt should look like http://ypal.net/zope3class/READMETxt | 19:00 |
wdickers | yup | 19:01 |
pcardune | ok, now lets implement PersonContainer | 19:01 |
pcardune | s/PersonContainer/IPersonContainer | 19:02 |
pcardune | so, back in README.txt | 19:02 |
pcardune | add a few blank lines, and we will begin writing the PersonContainer tests | 19:02 |
pcardune | start by importing a class called PersonContainer from timeclock.person | 19:03 |
pcardune | and run the test | 19:03 |
pcardune | then write code to make the test pass, then run the test again and make sure it passes | 19:03 |
wdickers | sorry to interrupt, but when does this class end again? o.o;; | 19:05 |
jelkner | 1 pm | 19:05 |
jelkner | 50 minutes from now | 19:05 |
wdickers | okay | 19:06 |
pcardune | so, is everyone done with that? | 19:06 |
jelkner | done | 19:06 |
wdickers | yup | 19:06 |
pcardune | now add tests to make sure that PersonContainer implements IPersonContainer | 19:07 |
jelkner | yuy: linda, how are you doing? | 19:07 |
Yuy | jelkner: as done as I'll ever be | 19:07 |
pcardune | run the test again (it should fail) | 19:07 |
wdickers | shouldn't it be "IPersonContainer"? | 19:08 |
wdickers | Wait, nvm | 19:08 |
pcardune | once you have done that, check out the solution at http://ypal.net/zope3class/PersonPy | 19:09 |
pcardune | notice that we are using a zope class called BTreeContainer | 19:09 |
pcardune | as you can guess, BTree stands for Binary Tree, and you should all know what those are (really cool data structurs with really fast searching) | 19:10 |
*** jinty has quit IRC | 19:11 | |
pcardune | just as before, inheriting from the Contained class (a preexisting implementation of IContained), the PersonContainer class inherits from BTreeContainer (a preexisting implementation of IContainer) | 19:11 |
pcardune | there are other implementation of IContainer that we could have user, like a Folder class, but we're not going to because Folders have extra things that we dont need | 19:12 |
pcardune | s/user/used | 19:12 |
pcardune | when copying this, dont forget the line "import zope.app.container.btree" up at the top | 19:13 |
wdickers | Sorry everyone, but I'm afraid I must leave now. I have a bowling tournament to get to | 19:14 |
Yuy | wdickers: good luck | 19:14 |
flint | pcardune, oddly enough, this tested without the "import zope.app.container.btree" statement | 19:14 |
jelkner | wdickers: knock those pins down! | 19:14 |
wdickers | xD Thanks | 19:15 |
*** wdickers has quit IRC | 19:15 | |
jelkner | my test must be wrong | 19:15 |
jelkner | i have: | 19:15 |
pcardune | flint: that is odd | 19:15 |
jelkner | >>> from timeclock.person import PersonContainer | 19:15 |
jelkner | >>> interfaces.IPersonContainer.implementedBy(PersonContainer) | 19:15 |
jelkner | True | 19:15 |
jelkner | and when i run the tests i get: | 19:15 |
jelkner | NameError: name 'PersonContainer' is not defined | 19:16 |
pcardune | jelkner: you must have a typo somewhere... because that should work | 19:16 |
flint | jelkner, it should be 'Person' not 'PersonContainer' eh? | 19:17 |
pcardune | and flint: dont forget to write a test that you can actually create a PersonContainer instance | 19:17 |
pcardune | no, jelkner has it right it seems | 19:17 |
pcardune | let me put up my README.txt file | 19:17 |
pcardune | check out http://ypal.net/zope3class/READMETxt | 19:18 |
pcardune | flint: if you had included people = PersonContainer() then it would have failed without the btree import | 19:18 |
* tiredbones is sick, I'll look at the logs later. Thanks for letting me ask question. | 19:19 | |
pcardune | tiredbones: i hope you feel better, and feel free to email me any questions about the log | 19:19 |
pcardune | so, is everyone on the same page now? | 19:20 |
Yuy | I hope so | 19:20 |
tiredbones | jelkner, do you have my email address? | 19:20 |
jelkner | tiredbones: no | 19:20 |
jelkner | all tests pass now | 19:21 |
flint | pcardune, If i am getting 20% of this, if i take this course five times all will be well. | 19:21 |
jelkner | what's next? | 19:21 |
pcardune | ok, we are done writing our implementation | 19:22 |
pcardune | we could write a few more tests to show how the PersonContainer actually contains Person objects... | 19:22 |
pcardune | but that isn't really necessary | 19:22 |
tiredbones | jelkner, do you have it now? I sent it to you privately | 19:22 |
jelkner | tiredbones: sent it where? | 19:23 |
pcardune | next, we are going to make the configur.zcml file | 19:23 |
pcardune | everyone knows what I'm talking about from the reading right? | 19:24 |
flint | pcardune, this is the thing that actually puts stuff on zope eh? | 19:24 |
pcardune | flint: so to speak | 19:24 |
tiredbones | jelkner, thru XChat. On a separate channel. | 19:24 |
jelkner | it didn't show up | 19:25 |
jelkner | just send me an email at: jeff@elkner.net | 19:25 |
tiredbones | jelkner, ok | 19:25 |
*** rjelliso has joined #schooltool | 19:25 | |
jelkner | so, configure.zcml | 19:26 |
*** rjelliso has joined #schooltool | 19:26 | |
*** rjelliso has joined #schooltool | 19:26 | |
pcardune | look at http://ypal.net/zope3class/ConfigureZcml | 19:26 |
rjelliso | Finally here (Again). | 19:27 |
jelkner | hi robbie | 19:27 |
pcardune | hi rjelliso | 19:27 |
Yuy | hello | 19:27 |
rjelliso | Hi | 19:27 |
Yuy | we do the config file straight on the vi editor? | 19:27 |
pcardune | Yuy: yep | 19:27 |
jelkner | i have a question about this file: | 19:28 |
jelkner | why the dot in front of: <content class=".person.Person">? | 19:28 |
jelkner | i mean why the leading . ? | 19:29 |
jelkner | in front of person | 19:29 |
pcardune | the leading . just says, (the current directory) | 19:29 |
jelkner | oh | 19:29 |
jelkner | thanks | 19:29 |
pcardune | person.Person would turn into /person/Person, and .person.Person would turn into ./person/Person (just like unix) | 19:29 |
pcardune | you could be explicit and say timeclock.person.Person if you wanted to | 19:30 |
pcardune | but most configure files don't look like that | 19:30 |
flint | pcardune, in the first line you have to register this namespace? what if you are on a private network? | 19:30 |
pcardune | flint: it doesn't actually do anything through the web | 19:31 |
pcardune | I'm not sure exactly how/why it works that way | 19:31 |
pcardune | but that is the way you have to do it | 19:31 |
flint | pcardune, that's good, it looks like it does something :^) | 19:31 |
jelkner | ok, now what? | 19:31 |
jelkner | we are almost out of time | 19:32 |
flint | pcardune, i am ok with the JCL of it all, it is the idea of doing what google maps did in javascript that worries me. | 19:32 |
pcardune | the explanation on pg 103 of stephan's book isn't much better than mine | 19:32 |
flint | we have 30 minutes jeff. | 19:32 |
jelkner | with this zcml file, can we see our new Person objects in a running zope? | 19:32 |
pcardune | no | 19:32 |
pcardune | this is the next step | 19:32 |
pcardune | we might not complete this, this lesson, but lets see how far we can get with your new knowledge of how things work | 19:33 |
pcardune | unfortunately, there isn't really a simple way of testing configure files | 19:33 |
pcardune | and they are kind of boring, so i wont go into a detailed explanataion of how configure.zcml works | 19:33 |
pcardune | it should be simple to understand after reading that chapter | 19:33 |
pcardune | so, next create a folder in timeclock called browser | 19:34 |
flint | pcardune, chapter 13. | 19:34 |
pcardune | it is standard to put all display related things in a browser module | 19:34 |
pcardune | flint: yes | 19:34 |
pcardune | don't forget to touch __init__.py to make it a python package | 19:35 |
pcardune | next go to the configure.zcml file we were just working with | 19:35 |
pcardune | and add at the bottom (but before the </configure>, the line: | 19:36 |
pcardune | <include package=".browser" /> | 19:36 |
pcardune | and then create a new file with the path (timeclock/browser/configure.zcml) | 19:36 |
jelkner | inside content tags, or outside | 19:36 |
jelkner | ? | 19:36 |
pcardune | jelkner: outside | 19:37 |
pcardune | just before </configure> | 19:37 |
pcardune | it should look like http://ypal.net/zope3class/ConfigureZcml | 19:37 |
pcardune | so, you should now have two configure.zcml files, one in timeclock, and one in timeclock/browser | 19:38 |
jelkner | how are they different? | 19:39 |
jelkner | or are they? | 19:39 |
pcardune | the one in browser will configure all the things related to what you see through a web browser | 19:39 |
pcardune | the one in timeclock configures internal zope machinery not related to what you see | 19:40 |
jelkner | but right now, our two files are the same, yes? | 19:40 |
pcardune | no, the one in browser should be empty | 19:40 |
jelkner | ahh | 19:40 |
flint | pcardune, you are kidding right? | 19:40 |
pcardune | flint: no, i'm not | 19:40 |
rjelliso | Oh, I thought the difference was the line at the bottom. (*oops*) | 19:40 |
pcardune | there is sort of a hierarchie of configure.zcml files | 19:41 |
pcardune | the zope instance has one, which includes ones for all relevant packages, which have other includes | 19:41 |
pcardune | its just like importing in python | 19:41 |
pcardune | or like includes in c++ | 19:42 |
rjelliso | ah, I think I get it then. | 19:42 |
pcardune | so to start off make some configure tags | 19:42 |
jelkner | so we are going to add content now to our configure.zcml in the browser folder? | 19:42 |
flint | pcardune, would a comment at the head of each of these cascading configure.zcml files be helpful | 19:42 |
flint | pcardune, the header commend would identify each files home. | 19:43 |
pcardune | flint: if you need it, you can put it in, but normally there aren't any comments like that | 19:43 |
*** jinty has joined #schooltool | 19:43 | |
flint | pcardune, job security for zope3 programmers, I am writing that book :^) | 19:43 |
pcardune | this time the configure tags should use the namespace http://namespaces.zope.org/browser | 19:44 |
pcardune | so, it should look like <configure xmlns="http://namespaces.zope.org/browser"> | 19:44 |
pcardune | so, now switch to python developer mode into website developer mode | 19:46 |
pcardune | s/to/from | 19:46 |
pcardune | we now have the ability to create PersonContainers and Person objects with python | 19:46 |
pcardune | now we want to do that through the web | 19:46 |
pcardune | so we need some kind of add form | 19:47 |
flint | pcardune, i am on maddog and will likely collide with lisa... I did not change ports where do I do this? | 19:47 |
pcardune | that is, some web page which lets us click "add Person Container" and input a name for the container and let us create it | 19:47 |
pcardune | flint: ~/zope3/etc/zope.conf | 19:48 |
pcardune | you should see | 19:48 |
flint | pcardune, yea the "address" line | 19:48 |
pcardune | <server> | 19:48 |
pcardune | type HTTP | 19:48 |
pcardune | address 8080 | 19:48 |
pcardune | </server> | 19:48 |
pcardune | ok, good | 19:48 |
pcardune | so, rather than having to write up html for our addform... we can auto generate one! | 19:49 |
pcardune | (you may remember talking about this 2 weeks ago | 19:49 |
pcardune | so, we define an add form like so: | 19:49 |
pcardune | <addform | 19:50 |
pcardune | label="Add Person Container" | 19:50 |
jelkner | where? | 19:50 |
pcardune | name="AddPersonContainer.html" | 19:50 |
pcardune | schema="timeclock.interfaces.IPersonContainer" | 19:50 |
pcardune | content_factory="timeclock.person.PersonContainer" | 19:50 |
pcardune | permission="zope.ManageContent" | 19:50 |
pcardune | /> | 19:50 |
pcardune | under the <configure ...> tag | 19:50 |
jelkner | ok | 19:50 |
pcardune | but before the </configure> line | 19:50 |
pcardune | if you all did the reading, this should make sense | 19:50 |
pcardune | but if you want, i will explain it | 19:50 |
pcardune | make sense to everyone? | 19:52 |
jelkner | pcardune: we are almost out of time | 19:53 |
pcardune | we are almost done | 19:53 |
jelkner | let's go then | 19:53 |
pcardune | now add another we want to have a link to this addform page... | 19:53 |
pcardune | <addMenuItem | 19:53 |
pcardune | class="timeclock.person.PersonContainer" | 19:54 |
pcardune | title="TimeClock Person Container" | 19:54 |
pcardune | description="A TimeClock Person Container" | 19:54 |
pcardune | permission="zope.ManageContent" | 19:54 |
pcardune | view="AddPersonContainer.html" | 19:54 |
pcardune | /> | 19:54 |
pcardune | this should also make sense after doing the reading | 19:54 |
pcardune | once you have that | 19:54 |
flint | ok | 19:54 |
pcardune | create the file timeclock/timeclock-configure.zcml | 19:55 |
pcardune | note that this is not in the browser directory | 19:55 |
pcardune | add one line to it: | 19:55 |
jelkner | wait | 19:55 |
flint | this is in the /browser/ configure.zcml | 19:55 |
pcardune | no, this is a new file | 19:55 |
pcardune | in timeclock folder | 19:55 |
jelkner | don't we need to close the configure tag? | 19:55 |
pcardune | jelkner: yes, you do | 19:56 |
jelkner | you didn't tell us to do that | 19:56 |
pcardune | well, i figure you all know how xml works | 19:56 |
pcardune | it is implied :) | 19:56 |
jelkner | you are figuring too much! ;-) | 19:56 |
flint | pcardune, got my vote paul!!! :^) | 19:56 |
pcardune | well, i was just making sure you were on your feet | 19:56 |
pcardune | so, the timeclock-configure.zcml file should have one line in it: | 19:57 |
pcardune | <include package="timeclock" /> | 19:57 |
pcardune | now, i want you to copy this file we just created to ~/zope3/etc/package-includes/ | 19:57 |
pcardune | this registers our timeclock application with zope | 19:58 |
pcardune | so when we start the zope server everything will run | 19:58 |
flint | pcardune, that is neat. | 19:58 |
pcardune | (of the timeclock stuff that is) | 19:58 |
flint | pcardune, I already started the zope server to test it. | 19:58 |
jelkner | wow, so let's pause and evaluate | 19:58 |
jelkner | we just finished "hello world!" | 19:58 |
pcardune | we have a copy in the timeclock folder so that when we right an install script/makefile, it will copy that file automatically | 19:58 |
jelkner | it only took us 6 hours | 19:58 |
rjelliso | copy the file? Or move it? (Or does it matter?) | 19:59 |
jelkner | zope3 is *easy* ! ;-) | 19:59 |
pcardune | copy it | 19:59 |
pcardune | well, now test what you ahve | 19:59 |
flint | i am in zopectl and restarted my zope... | 19:59 |
pcardune | start the zope server | 19:59 |
pcardune | (zope3/bin/runzope) | 19:59 |
pcardune | or you can use zopectl if you know how | 19:59 |
pcardune | open a web browser | 19:59 |
pcardune | log in to your zope instance | 19:59 |
pcardune | go to the manage screen | 20:00 |
flint | Paul, I did not need to log on at port 8020 of maddog. | 20:00 |
pcardune | it has a url like http://localhost:8080/manage (depending on your port) | 20:00 |
flint | never mind I logged on. | 20:00 |
pcardune | on the left hand side you should see a list of things you can "Add" | 20:00 |
flint | ++etc++site? | 20:00 |
pcardune | flint: that might end up in your browser, i am currently at http://localhost:8080/@@contents.html | 20:01 |
flint | I can add a site manager folder... | 20:01 |
flint | nice got it. | 20:01 |
pcardune | does everyone see the list of stuff to add? | 20:01 |
jelkner | i don't see Person | 20:01 |
flint | yes | 20:01 |
pcardune | in that list should be "TimeClock Person Container" | 20:02 |
pcardune | jelkner: we didn't do that part yet | 20:02 |
flint | indeed! | 20:02 |
pcardune | click on it | 20:02 |
pcardune | now you see our auto generated form | 20:02 |
pcardune | type in an object name with no spaces | 20:02 |
pcardune | and click add | 20:02 |
pcardune | we have now created our first object through the web | 20:03 |
jelkner | yeah! | 20:03 |
rjelliso | Finally, results! : > | 20:03 |
Yuy | (my parents are calling me to get off) I can take what I need from the log tomorrow, right? | 20:03 |
pcardune | we are done | 20:03 |
pcardune | you are free to go | 20:03 |
jelkner | we need homework | 20:03 |
pcardune | I will email it | 20:03 |
Yuy | I can stay to hear that | 20:03 |
jelkner | bye linda | 20:03 |
Yuy | kk | 20:03 |
flint | where is this object... bye linda | 20:03 |
Yuy | bye everyone | 20:04 |
*** Yuy has left #schooltool | 20:04 | |
flint | pcardune, the one we created... | 20:04 |
pcardune | this object is in the root folder of your zope instace | 20:04 |
pcardune | instance | 20:04 |
flint | na i mean on the web interface side. | 20:04 |
flint | once it is created it should be somewhere eh? | 20:04 |
*** ignas has quit IRC | 20:05 | |
pcardune | yeah, in the root folder of zope | 20:05 |
pcardune | the web side | 20:05 |
flint | pcardune, I am being a little picky, and I am gratified we got this far... | 20:05 |
flint | gotcha there it is. | 20:05 |
pcardune | http://localhost:8080/whateveryouputfortheobjectname | 20:05 |
pcardune | that is where it is | 20:05 |
pcardune | you will only see the introspector because we haven't made any other pretty views for it | 20:06 |
pcardune | hold on, i will be right back | 20:06 |
pcardune | i have to switch rooms and log off for a minute | 20:06 |
flint | jelkner, http://maddog.yhspatriot.net:8020/paul = "The page that you are trying to access is not available" | 20:07 |
flint | jelkner, i called the object paul. | 20:08 |
flint | got a clue? | 20:08 |
pcardune | flint: you must have forgotten to click "add" or something | 20:08 |
flint | pcardune, na the silly thing is there, check for yourself. there is a folder object called "paul" | 20:09 |
flint | admin for this instance is flint password is yellow you-know-what. | 20:09 |
flint | pcardune, paul, note that I am good to get this far this week. | 20:10 |
pcardune | i'm looking at it | 20:11 |
flint | jelkner, what are you up to? | 20:11 |
*** ignas has joined #schooltool | 20:11 | |
flint | ignas, greetings are you one of the POV? | 20:11 |
*** ignas has quit IRC | 20:11 | |
jelkner | see you all next week! | 20:12 |
pcardune | flint: i can't seem to log in to your instance | 20:12 |
*** jelkner has quit IRC | 20:13 | |
pcardune | oh wait... nvm | 20:13 |
pcardune | i got in | 20:13 |
flint | pcardune, hang on... it is flint and banana | 20:13 |
pcardune | ok, instead of putting in that url | 20:13 |
pcardune | go back to that @@contents.html page | 20:13 |
rjelliso | I've got to dash as well : < There's anything revolutionary coming up or will checking the logs/email later be ok? | 20:13 |
pcardune | or click on [top] | 20:13 |
pcardune | rjelliso: we are done | 20:14 |
pcardune | everyone is free to go | 20:14 |
pcardune | class dismissed | 20:14 |
rjelliso | alright, thanks, talk to you next week then. | 20:14 |
*** rjelliso has quit IRC | 20:14 | |
flint | i am at top. if you gotta stop paul we can. | 20:14 |
pcardune | flint: after you click on top, now click on paul | 20:14 |
flint | goes into an inspector is that correct? | 20:15 |
pcardune | flint: its 10am... there is nothing for me to do this early in the morning except homework... and this sounds a lot more appealing than that | 20:15 |
pcardune | flint: yeah | 20:15 |
pcardune | that's all there is to see at this point | 20:15 |
flint | ok then it works, I though that was a dreaded zope error page. this is good. | 20:15 |
pcardune | you homework is going to be to add more browser views | 20:15 |
flint | no, you should make us stick needles in our necks, less painful. What chapter? | 20:16 |
pcardune | same chapter | 20:16 |
pcardune | 13 is a pretty big/important chapter | 20:17 |
pcardune | and a prime number! | 20:17 |
pcardune | you gotta love it | 20:17 |
flint | great, i am going to chop off an earlobe so I can find the next less painful thing. :^) | 20:17 |
flint | pcardune, you are doing fine. it helps that things are working. I am gonna transfer what happened on maddog and get it working on docbox. | 20:18 |
pcardune | good | 20:18 |
flint | docbox is a strange beast but is in a production mode. | 20:18 |
flint | this went well. I am gonna go get coffee. thanks. | 20:18 |
flint | sksk\ | 20:19 |
pcardune | your welcome | 20:19 |
*** flint has quit IRC | 20:19 | |
pcardune | bye | 20:19 |
*** pcardune has quit IRC | 20:21 | |
*** ignas has joined #schooltool | 20:29 | |
*** ignas has quit IRC | 22:25 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!