*** Ninno2 has joined #schooltool | 00:21 | |
*** Ninno has quit IRC | 00:39 | |
*** jinty has quit IRC | 01:59 | |
*** wrobel has quit IRC | 03:16 | |
*** kjcole has joined #schooltool | 03:18 | |
*** Mounika has joined #schooltool | 03:19 | |
*** Lumiere changes topic to "SchoolTool development | IRC logs at http://source.schooltool.org/irclogs/ | Dev meetings Mon, 14:30 UTC (16:30 EET) | Use http://paste.lisp.org/new/schooltool for pasting | pcardune's Zope class continues Saturday" | 05:08 | |
*** _kjcole has joined #schooltool | 05:35 | |
Lumiere | hi | 05:35 |
---|---|---|
*** kjcole has quit IRC | 05:47 | |
*** _kjcole has quit IRC | 07:21 | |
*** Lumiere changes topic to "SchoolTool development | IRC logs at http://source.schooltool.org/irclogs/ | Dev meetings Mon, 14:30 UTC (16:30 EET) | Use http://paste.lisp.org/new/schooltool for pasting | pcardune's Zope class continues Saturday noon US/Eastern" | 07:31 | |
*** Z3R0 has joined #schooltool | 09:41 | |
*** Ninno2 has quit IRC | 10:13 | |
*** jinty has joined #schooltool | 11:33 | |
*** kjcole has joined #schooltool | 15:40 | |
*** th1a_ has quit IRC | 15:45 | |
*** Aiste has quit IRC | 15:45 | |
*** didymo has quit IRC | 15:45 | |
*** Aim2 has quit IRC | 15:45 | |
*** Aim2 has joined #schooltool | 15:47 | |
*** th1a_ has joined #schooltool | 15:47 | |
*** Aiste has joined #schooltool | 15:47 | |
*** didymo has joined #schooltool | 15:47 | |
*** t3h_sood has joined #schooltool | 18:15 | |
*** Preetam has joined #schooltool | 18:32 | |
*** Preetam has left #schooltool | 18:33 | |
*** bnguyen has joined #schooltool | 18:34 | |
*** nitromaster has joined #schooltool | 18:36 | |
*** mlinnell has joined #schooltool | 18:36 | |
*** Makorihi has joined #schooltool | 18:38 | |
*** pcardune has joined #schooltool | 18:45 | |
*** mattva01 has joined #schooltool | 18:45 | |
*** aelkner has joined #schooltool | 18:48 | |
t3h_sood | And the silence is broken. | 18:52 |
aelkner | pcarduner: are you tere? | 18:54 |
*** tehminkeh has joined #schooltool | 18:54 | |
*** tehminkeh has left #schooltool | 18:54 | |
kjcole | aelkner, he's around. He just sent me a message a minute ago. | 18:55 |
t3h_sood | by the by, that lesson that you e-mailed, at least for me, resulted in a 404... | 18:55 |
*** tehminkeh has joined #schooltool | 18:56 | |
kjcole | t3h_sood: for one of the files at the bottom or the whole thing? | 18:56 |
t3h_sood | every file at the bottom | 18:56 |
*** Mounika has joined #schooltool | 18:56 | |
kjcole | t3h_sood: (There was a list of links to source files, but one of them was broken a few days ago.) | 18:58 |
t3h_sood | Well, all of them were broken | 18:58 |
*** Mounika is now known as mgarlapa | 18:59 | |
kjcole | the ones at http://ibiblio.org/obp/pyBiblio/courses/zope3class/lesson01/index.html | 18:59 |
kjcole | are all working now. | 18:59 |
*** Preetam has joined #schooltool | 18:59 | |
t3h_sood | ... | 19:00 |
pcardune | Ok, it's 12 noon by my clock | 19:00 |
pcardune | which means it is time to start the class | 19:00 |
pcardune | is anyone *not* here? | 19:00 |
* kjcole is Kevin Cole | 19:00 | |
t3h_sood | it seems that I had went to the wrong link | 19:00 |
t3h_sood | or something <_< | 19:00 |
kjcole | Jeff's out saving the world from the Bush administration, so he won't be attending. | 19:01 |
pcardune | Ok, let's get started | 19:01 |
pcardune | if you haven't already, log into maddog | 19:02 |
pcardune | and start up your zope server | 19:02 |
t3h_sood | that's extremely wierd, the link I had in my e-mail links to the lesson, but it used to be a different page, because I definitely don't remember it looking like that... | 19:02 |
t3h_sood | oh, sorry | 19:02 |
pcardune | let's cover a bit of what we did in the last lesson | 19:02 |
pcardune | Last week we created the interfaces.py file and wrote our first interface: IContact. | 19:03 |
tehminkeh | kjcole: what's he doing? | 19:03 |
pcardune | Recall that an interface is a kind of contract that implementations (in the form of python classes) need to fullfill. With interfaces we can define which attributes and methods the implementation must have. Interfaces also provide us with a good place for documenting the functionality of components in our system. | 19:03 |
pcardune | We also went ahead and made an implementation of the IContact interface in the contact.py file. We then configured this implementation in the configure.zcml file, and even got to the point where we were able to add an instance of the Contact class to the database through the ZMI. | 19:04 |
pcardune | Hopefully you were all able to get it to work | 19:05 |
pcardune | If not, I recommend you ask each other for help now, as we will be moving on | 19:05 |
pcardune | If you want to make sure your code works, you can download a tarball of it from here: http://www.ibiblio.org/obp/pyBiblio/courses/zope3class/lesson01/zcontact-lesson01.tar | 19:05 |
pcardune | That should give you everything we did last week | 19:05 |
t3h_sood | what was the url for the place for us to see what zope's doing? yhspatriot something or another? | 19:06 |
pcardune | maddog.yhspatriot.net:whateveryourportis | 19:06 |
tehminkeh | t3h_sood: maddog@yhspatriot.net | 19:06 |
pcardune | tehminkeh, that doesn't point to anything | 19:07 |
pcardune | so if you didn't already, create an instance of the Contact class through the ZMI | 19:08 |
mlinnell | what's ZMI? | 19:08 |
tehminkeh | t3h_sood: maddog.yhspatriot.net rofl..... | 19:08 |
pcardune | the ZMI stands for Zope Management Interface | 19:08 |
pcardune | it is the interface you get when you browse to your running zope server in a web browser | 19:09 |
pcardune | where you can log in as well | 19:09 |
pcardune | it looks something like this: http://www.carduner.net:8080/ | 19:10 |
*** Z3R0 has left #schooltool | 19:10 | |
pcardune | Has anyone not created and instance of the Contact class through the ZMI? | 19:10 |
Lumiere | me XD | 19:10 |
*** Mounika has joined #schooltool | 19:11 | |
t3h_sood | where was the listing of port numbers? | 19:11 |
Lumiere | on the cando wiki | 19:11 |
t3h_sood | oye | 19:11 |
nitromaster | when you do runzope it will tell you your port number | 19:12 |
pcardune | https://svn.schooltool.org/trac/cando-auth/wiki/MadDog | 19:12 |
t3h_sood | oh | 19:12 |
t3h_sood | yay | 19:12 |
t3h_sood | it told me <_< | 19:12 |
pcardune | If you click on the contact object you have created, what do you get? (one person answer please) | 19:12 |
aelkner | Object Introspector: zcontact.contact.Contact ( testzcontact )? | 19:13 |
pcardune | yes, that's right | 19:13 |
pcardune | aelkner, everything is working great for you :) | 19:13 |
pcardune | The object Introspector is the default view you get for all objects | 19:14 |
pcardune | it just gives you information about the object you are looking at. | 19:14 |
aelkner | If anyone is not getting this, please chime in. | 19:14 |
pcardune | But this is no good for us because we want to display information about the Contact object like "lastName" and we don't want all this other junk | 19:14 |
mlinnell | where do you click? | 19:14 |
tehminkeh | hmm | 19:15 |
tehminkeh | where is the object introspector? | 19:15 |
Lumiere | the object introspector is the default 'view' for an object | 19:15 |
aelkner | mlinnell: first you need to hit the ZContact Page link in the Add menu to the left. | 19:16 |
aelkner | Then you fill in the name and hit enter. | 19:17 |
aelkner | Then you see that name in the folder in the middle. | 19:17 |
aelkner | Click on that name to view the object. | 19:17 |
tehminkeh | after I authenticate as the Manager on my zope instance, where do I go to make an instance of Contact? | 19:17 |
nitromaster | I've got a question, why does is the size for my testzcontact n/a? | 19:17 |
pcardune | because zope doesn't know how to calculate the size of the object | 19:18 |
pcardune | sometimes it makes more sense to specify the size of an object in terms other than kb | 19:18 |
Makorihi | when we create the contact and click on the name, are we suppose to get a message saying 'this object is not registered'? | 19:19 |
pcardune | for example, you might have a blog, and for the size you want it to show how many entries have been made, not how many kb it takes up | 19:19 |
pcardune | Makorihi, yeah, that could happen to | 19:19 |
nitromaster | so the size will show that? Once it works and all? | 19:19 |
pcardune | nitromaster, if we set it up that way | 19:19 |
pcardune | Makorihi, click on the "Instrospector" tab to see what we are all looking at | 19:19 |
mlinnell | should we register the object? | 19:20 |
pcardune | mlinnell, no, don't do anything yet | 19:20 |
pcardune | The first thing to do is to create a new file called viewcontact.pt. The .pt part stands for Page Template. | 19:20 |
Lumiere | pcardune: there are still a few people that don't see zcontact | 19:20 |
Lumiere | as something to add | 19:20 |
pcardune | If you don't see zcontact as something to add, then you probably forgot the step of copying the zcontact-configure.zcml file to the zope/etc/package-includes/ directory | 19:21 |
Makorihi | to add zcontact to the list, you have to addMenuItem in the configure.zcml file | 19:21 |
t3h_sood | oh | 19:21 |
Lumiere | and if that isn't it? | 19:21 |
pcardune | this file is what we call a "slug" and it tells zope about the zcontact package | 19:21 |
tehminkeh | yeah | 19:21 |
pcardune | also don't forget to *restart* your zope server after copying this file | 19:21 |
tehminkeh | after I login to my zope instance on my browser | 19:21 |
tehminkeh | what do i do? | 19:22 |
aelkner | mlinnell: are you getting the Introspector screen now? | 19:22 |
Makorihi | tehminekeh, if everything is working alright, click on 'top' and there should be zcontact in the list on the left | 19:22 |
mlinnell | aelkner: I can't find the Introspector tab | 19:22 |
t3h_sood | everything is copied in | 19:22 |
t3h_sood | but I still don't see anything | 19:22 |
t3h_sood | what was the configure.zcml thing supposed to do again? | 19:23 |
t3h_sood | oh | 19:23 |
pcardune | t3h_sood, can you give us the url to your zope server | 19:23 |
aelkner | mlinnell: Do you have ZContact Page in your Add menu? | 19:23 |
t3h_sood | maddog.yhspatriot.net:8123 | 19:23 |
mlinnell | aelkner: yes, I clicked that | 19:23 |
t3h_sood | and no, I don't have that | 19:23 |
t3h_sood | because I forgot where configure is, it's in the zcontact folder, right? | 19:23 |
aelkner | mlinnell: So what do you get when you click on the page you just added? | 19:24 |
pcardune | Make sure you follow the directions towards the end of the first lesson: http://www.ibiblio.org/obp/pyBiblio/courses/zope3class/lesson01/index.html | 19:24 |
pcardune | we need to move on, so please try to get everything working | 19:25 |
pcardune | and you can message me or aelkner for help | 19:25 |
mlinnell | aelkner: it says it isn't registered | 19:25 |
pcardune | mlinnell, it doesn't need to be registered | 19:25 |
mlinnell | hm | 19:25 |
aelkner | click on the Introspecto tab. | 19:26 |
pcardune | we will talk about what "registered" means *much* later | 19:26 |
Lumiere | pcardune: I didn't have the browser info to have a menu item | 19:26 |
kjcole | I added a Z Contact, but when I click on it, I'm asked to register it... Did I miss something? | 19:26 |
pcardune | *Do Not Worry About "Registering"* | 19:26 |
mlinnell | I don't see a Introspecto tab | 19:26 |
aelkner | pcardune: Aren't people stuck if they don't get the Introspector tab? | 19:27 |
pcardune | Not necessarily, It is not vital to what we are about to do | 19:27 |
aelkner | Ok. | 19:27 |
kjcole | This "default view" you speak of, doesn't happen when I click on what I've added. | 19:27 |
pcardune | so just make sure you can click on that link in the Add Menu and that is all that matters at the moment | 19:27 |
pcardune | Now I want to talk about page templates | 19:28 |
pcardune | All of you have probably had some experience making websites with static web pages. Each page in your website corresponds to a file on the server's file system. | 19:28 |
pcardune | If you want the pages to have a certain look and feel, then you might create a template page with empty spaces where you intend to fill in information like heading, content, and a maybe a picture. The template might already contain links to the main pages on your site, so that they can be accessed from anywhere. | 19:28 |
pcardune | With web applications however, most of the pages you see are dynamically generated. That means that each page you see does not have a corresponding file on the server, but rather it is generated from a template, with the empty spaces being filled in based on data from a database. | 19:29 |
pcardune | Zope3 uses ZPT (Zope Page Templates) as its primary templating language. You can write templates in DTML as well, but this is not standard practice nor recommended. | 19:30 |
pcardune | So let's start writing a page template and I'll explain how it works as we go. Open up the viewcontact.pt file for editing and type the following lines: | 19:30 |
pcardune | <html> | 19:30 |
pcardune | <body> | 19:30 |
pcardune | <h1>Z Contact</h1> | 19:30 |
pcardune | <h3>Last Name: <b tal:content="context/lastName">last name</b></h3> | 19:30 |
pcardune | </body> | 19:30 |
pcardune | </html> | 19:30 |
tehminkeh | where is viewcontact.pt? | 19:31 |
Lumiere | make it | 19:31 |
Lumiere | in your zcontact folder | 19:31 |
pcardune | right Lumiere | 19:31 |
pcardune | As you can see, what we have written here looks a lot like a regular html file. The only difference is that the <b> tag has this strange tal:content attribute. | 19:32 |
pcardune | So, last week we discussed a little bit about namespaces relating to the zcml file | 19:34 |
pcardune | we made use of the "browser" name with the browser:addMenuItem tag | 19:34 |
pcardune | tal is another namespace specific to zope, and within that name space are all the attributes you can use with page templates | 19:34 |
pcardune | This attribute is called a tal expression or tales for short. The tal:content attribute tells zope that the content of the b tag (what goes between <b> and </b>) should be filled with the data stored in context/lastName. | 19:35 |
pcardune | When zope processes this template and generates the final html page, it will ignore what is already inside the b tag. | 19:35 |
nitromaster | then can't we just leave it blank? | 19:36 |
eldafar | Yes, but you can also put something meaningful there, so that when people read it | 19:36 |
eldafar | they have an idea of what will be there | 19:36 |
pcardune | thank you eldafar, that is exactly what I was going to say | 19:36 |
eldafar | ;) | 19:36 |
Lumiere | it's also the default display information | 19:36 |
pcardune | the context/lastName part is a tales path expression. | 19:36 |
pcardune | The context part says that we are accessing the object for which this page is being displayed (i.e. the context of the page). | 19:37 |
pcardune | in our case, the context is a contact object | 19:37 |
Lumiere | so if for whatever reason you don't have a last name entered... that text shows (it is also useful for testing on a web browser) | 19:37 |
pcardune | Lumiere, not quite right | 19:37 |
pcardune | you already do have a last name entered, but it is an empty string | 19:37 |
pcardune | so the b tag will be filled with an empty string | 19:37 |
aelkner | pcardune: we could point out what you liked to separate which was designers from programmers.. Designers would see what is between the <b> and </b> tags without even having zope running, right? | 19:38 |
pcardune | the "Default" text only shows when you open up the actual .pt file in a web browser (not through zope, but through your filesystem) | 19:38 |
pcardune | aelkner, correct, that is one of the big reasons why we use ZPT instead of DTML | 19:38 |
pcardune | then obviously, the lastName part accesses the lastName attribute of the object. | 19:39 |
pcardune | This expression is the tales equivalent to the expression in python context.lastName. | 19:39 |
pcardune | we just use a / instead of a . and we will see why in future lessons | 19:39 |
pcardune | so after you created the .pt file you should try opening up in your browser | 19:40 |
pcardune | the path would be something like file:///home/pcardune/zope3/lib/python/zcontact/viewcontact.pt | 19:41 |
aelkner | Doesn't it need to be added to the zcml file first? | 19:41 |
kjcole | how? since we're running on maddog? | 19:41 |
kjcole | (file:/// ain't gonna cut it.) | 19:42 |
pcardune | ooo... if you are running on maddog, you wont be able to look at the file, unless you use lynx... | 19:42 |
pcardune | ok, scratch that part then, lets go right on to connect this page template to the contact object through ZCML | 19:42 |
Makorihi | and links or elinks, no? | 19:42 |
pcardune | Now that we have this page template file, it would be nice to see it in action. Before we are able to do that, we have to connect it to our Contact class and configure permissions for it. Open up the configure.zcml file and add the following lines: | 19:42 |
pcardune | Makorihi, anything that works in a teminal really | 19:43 |
pcardune | <browser:page | 19:43 |
pcardune | for="zcontact.interfaces.IContact" | 19:43 |
pcardune | name="index.html" | 19:43 |
pcardune | permission="zope.View" | 19:43 |
pcardune | template="viewcontact.pt" | 19:43 |
pcardune | /> | 19:43 |
pcardune | Be sure to put this tag within the configure tags. | 19:43 |
pcardune | The for attribute specifies the interface for which this page can appear. When we connect a page template to an object, we really want to connect it to an interface. | 19:44 |
pcardune | For example, if we had multiple classes that all implemented the same interface, then one page template would work for all the different classes because each class provides the same attributes. | 19:44 |
pcardune | For that reason we register pages with interfaces. | 19:45 |
pcardune | The name attribute specifies how we access this page template through a url. By setting the name to index.html then this page template is the default one used for the object. (instead of either the registration page or the introspector page) | 19:45 |
tehminkeh | when we make changes like this? | 19:46 |
tehminkeh | do we have to restart zope | 19:46 |
tehminkeh | to see them | 19:46 |
pcardune | tehminkeh, yes | 19:46 |
tehminkeh | poo. | 19:46 |
pcardune | any time you edit zcml or .py files, you have to restart the zope server | 19:46 |
pcardune | you get used to it... | 19:46 |
pcardune | Finally, the template attribute obviously specifies the path to the file where the template is located. | 19:47 |
pcardune | With the page attribute in the configure.zcml file, we should be able to restart the zope server and try out the page template. | 19:47 |
nitromaster | wowsers, everyone is restarting their zope instances and its taking forever | 19:48 |
Preetam | yea | 19:48 |
pcardune | when it has restarted, go back to the ZMI and click on your contact object again | 19:49 |
pcardune | and you should get the page template we just created | 19:49 |
Makorihi | so basically, the configure makes it so that when you press on any Contact object, it calls the .pt file with that object as its context? | 19:51 |
kjcole | I still get "This object is not yet registered" | 19:51 |
pcardune | Makorihi, exactly | 19:51 |
Lumiere | kjcole: use the preview button | 19:51 |
nitromaster | i can't access it through zope, i have to go maddog.yhspatriot.net:8101/zcontact/ that's the only way it'll work for me | 19:51 |
Lumiere | in the folder above your contact | 19:51 |
pcardune | you could also be explicit and just go to maddog.yhspatriot.net:8101/zcontact/index.html | 19:52 |
pcardune | we will worry about *navigation* a bit more later | 19:52 |
pcardune | the key thing is that by going to the url maddog.yhspatriot.net:8101/zcontact/index.html you should get the generated html page | 19:52 |
pcardune | (put in your port number and not nitromaster's | 19:52 |
Preetam | it is blank after Last Name: | 19:52 |
Lumiere | yes | 19:52 |
pcardune | yep, we haven't entered anything in for the lastName attribute, it is just an empty string | 19:53 |
tehminkeh | OMG | 19:53 |
tehminkeh | thats pretty nifty | 19:53 |
Lumiere | lol... you haven't seen nifty yet ^^ | 19:54 |
pcardune | ok, but now we want to actually set this lastName attribute right | 19:54 |
pcardune | so to do that we are going to have to write another page template file | 19:54 |
mattva01 | ok i see how this all works | 19:54 |
pcardune | this time with an html form | 19:54 |
pcardune | Create and edit a new file called editcontact.pt and add to it the following lines of code: | 19:54 |
pcardune | <html> | 19:54 |
pcardune | <body> | 19:54 |
pcardune | <h1>Z Contact</h1> | 19:54 |
pcardune | <form action="index.html"> | 19:54 |
pcardune | <h3>Last Name: | 19:54 |
pcardune | <input type="text" name="lastName" | 19:54 |
pcardune | tal:attributes="value context/lastName" /> | 19:54 |
pcardune | </h3> | 19:54 |
pcardune | <input type="submit" name="SAVE" value="Save" /> | 19:54 |
pcardune | </form> | 19:54 |
pcardune | </body> | 19:55 |
pcardune | </html> | 19:55 |
pcardune | Feel free to spice up the html a bit if you don't like my over simplified layouts and stuff | 19:55 |
pcardune | I assume you all know about html forms already | 19:55 |
pcardune | if you don't ask someone who does | 19:55 |
pcardune | The only new thing here is the tal:attributes attribute on the input tag. Instead of filling in the content of a tag like the tal:content attribute did, this tales fills in the value for another attribute on the tag. | 19:55 |
pcardune | n this case we are setting the "value" attribute of the input tag (which is what you see in the input box) to whatever the lastName attribute is currently set to. | 19:56 |
pcardune | Even here you might set the value attribute to value="Last Name" so that a web designer would have something to look at when they open the pt file | 19:57 |
pcardune | but just like tal:content did, whatever is specified for the value attribute will be replaced when the html is actually generated | 19:57 |
*** th1a_ has quit IRC | 19:58 | |
pcardune | Again we will add another browser:page tag to the configure.zcml file that looks like this: | 19:58 |
pcardune | <browser:page | 19:58 |
pcardune | for="zcontact.interfaces.IContact" | 19:58 |
pcardune | name="edit.html" | 19:58 |
pcardune | permission="zope.ManageContent" | 19:58 |
pcardune | template="editcontact.pt" | 19:58 |
pcardune | /> | 19:58 |
tehminkeh | how come you put the /> on its own line for configure and not for the .pt files? | 19:59 |
pcardune | the zope.ManageContent permission is given by default to anyone who is logged in | 19:59 |
Makorihi | its just the style | 19:59 |
pcardune | you can do it either way | 19:59 |
Lumiere | tehminkeh: it's a fairly standard style for lines over 80 characters on xml | 20:00 |
pcardune | I'm not always totally consistent with that | 20:00 |
tehminkeh | ok | 20:00 |
Lumiere | if you want to remove one of those attributes... | 20:00 |
tehminkeh | thats what i was wondering | 20:00 |
Lumiere | it is much easier if you don't have to fix the /> every time | 20:00 |
Lumiere | you just kill the line | 20:00 |
tehminkeh | yeah, but I was wondering why it didnt apply for the .pt files too | 20:00 |
Lumiere | page templates follow html conventions more then xml conventions | 20:01 |
pcardune | hopefully you guys are all ahead of me and have already restarted your zope servers and gone to maddog.yhspatriot.net:8101/zcontact/edit.html | 20:01 |
Lumiere | or are restarting.... | 20:01 |
Makorihi | ya, it takes a looooooong time to restart | 20:01 |
pcardune | (top tells me everyone is restarting) | 20:01 |
Makorihi | even when nobody else is doing it | 20:01 |
pcardune | some folks have been working on ways to speed up the start up time | 20:02 |
mlinnell | for me it says: The page that you are trying to access is not available | 20:02 |
tehminkeh | apparently, they are failing | 20:02 |
eldafar | why don't you go and set things in order then? lol | 20:03 |
pcardune | tehminkeh, no, we just aren't using their code because it is not part of the zope trunk src yet | 20:03 |
Makorihi | what is an i18n translation domain? | 20:03 |
mlinnell | nvm, figured it out | 20:03 |
tehminkeh | pcardune: I was just kidding | 20:03 |
pcardune | tehminkeh, i know | 20:03 |
pcardune | Makorihi, the i18n translation domain is for internationalization support | 20:03 |
Makorihi | oh | 20:03 |
Makorihi | okay | 20:03 |
pcardune | we aren't going to be worrying about that until somewhat later | 20:03 |
pcardune | ok, looks like all the servers have restarted by now | 20:05 |
Makorihi | mine is working | 20:05 |
pcardune | you might want to add a link to the edit page from the index.html page... something like <a href="edit.html">Edit</a> | 20:05 |
pcardune | remember, if you change a pt file, you don't have to restart the zope server | 20:05 |
tehminkeh | zope it not cooperating | 20:06 |
tehminkeh | with looking at the file directly | 20:06 |
Makorihi | how so? | 20:06 |
tehminkeh | http://maddog.yhspatriot.net:8116/zcontact/ | 20:07 |
Makorihi | maddog.yhspatriot.net:<yourport>/<nameofcontactclass>/index.html | 20:07 |
tehminkeh | doesn't show me the index page | 20:07 |
*** th1a_ has joined #schooltool | 20:07 | |
tehminkeh | yes, tried that too | 20:07 |
Lumiere | hi tom | 20:07 |
Makorihi | what is your port>? | 20:07 |
tehminkeh | 8116 | 20:07 |
pcardune | tehminkeh, when you added the contact object, what did you call it? | 20:07 |
Makorihi | i see it | 20:08 |
Makorihi | http://maddog.yhspatriot.net:8116/testzcontact | 20:08 |
Makorihi | isnt that yours? | 20:08 |
tehminkeh | oh | 20:08 |
tehminkeh | i see how it works | 20:08 |
pcardune | that is what you want to use | 20:08 |
Makorihi | and you can do | 20:08 |
Makorihi | http://maddog.yhspatriot.net:8116/testzcontact/edit.html | 20:08 |
Makorihi | if you have it working | 20:08 |
tehminkeh | yeah | 20:08 |
tehminkeh | i did | 20:08 |
tehminkeh | i thought it was | 20:08 |
tehminkeh | zcontact | 20:08 |
tehminkeh | like it was in the filesystem | 20:08 |
tehminkeh | but you have to go through what you named the object | 20:09 |
pcardune | yep | 20:09 |
aelkner | pcardune: you might want to explain how zope works based on objects and contexts. | 20:09 |
tehminkeh | so, are we going to make the submit button actually work? | 20:09 |
tehminkeh | or just leave it broken | 20:09 |
pcardune | tehminkeh, yes | 20:09 |
tehminkeh | oh | 20:09 |
tehminkeh | ok | 20:09 |
tehminkeh | neato | 20:09 |
pcardune | so, since the action attribute points to the index.html page, clicking on save is going to send us there | 20:10 |
pcardune | but we need to write some code that will actually process the data sent through the web request | 20:10 |
pcardune | when click "Save" your browser sends the form data through the web in what is called a request (in case you didn't know that already) | 20:10 |
pcardune | take a look at the url that is given when you click on save | 20:11 |
pcardune | it has a ?lastName=something on the end of it | 20:11 |
pcardune | that is where the data is being passed | 20:11 |
Makorihi | like php | 20:11 |
pcardune | right | 20:11 |
pcardune | We need to write what is called a browser view class to process the information entered into the form. | 20:11 |
pcardune | Create and edit a new file called browser.py and add the following lines: | 20:11 |
pcardune | import zope.security.proxy | 20:11 |
pcardune | class ContactView(object): | 20:11 |
pcardune | """View for showing and modifying a contact""" | 20:11 |
pcardune | def __init__(self, context, request): | 20:11 |
pcardune | self.context = context | 20:11 |
pcardune | self.request = request | 20:11 |
pcardune | if self.request.get("SAVE"): | 20:12 |
pcardune | context = zope.security.proxy.removeSecurityProxy(self.context) | 20:12 |
pcardune | context.lastName = self.request.get("lastName") | 20:12 |
pcardune | To better understand how this is supposed to work, I will write out what happens in steps: | 20:12 |
pcardune | 1. User inputs data into form | 20:13 |
pcardune | 2. User submits data using the Save button | 20:13 |
pcardune | 3. Data gets sent to the index.html page via the url (looks like http://localhost/contact/index.html?lastName=Whatever | 20:13 |
pcardune | 4. The browser view class for the index.html page gets instantiated and processes the data, which is stored in a request object | 20:13 |
pcardune | 5. Finally, the index.html page gets rendered with the updated information | 20:13 |
pcardune | when browser view classes are instantiated, they get sent the context object (the same one the page templates access) and the request object (with all the data in it) | 20:14 |
pcardune | this is why we have to put context and request in the __init__ method (and always in that order) | 20:14 |
pcardune | the request object is like a python dictionary | 20:14 |
pcardune | the self.request.get("SAVE") checks that we did in fact click on the save button | 20:15 |
pcardune | then there is the removeSecurityProxy bit | 20:15 |
pcardune | normally, web pages are not allowed to modify the data stored in an object | 20:15 |
tehminkeh | is this code already malicious input safe? | 20:15 |
tehminkeh | does zope take care of that? | 20:16 |
pcardune | that is, the context is surrounded by a protective wrapper called a security proxy | 20:16 |
tehminkeh | or will it crash with bad input | 20:16 |
pcardune | tehminkeh, yeah, zope takes care of that | 20:16 |
t3h_sood | Sorry for taking us back about an hour, but, I can't log in, at all. | 20:16 |
Lumiere | aelkner, t3h_sood can you join #cando-help | 20:17 |
t3h_sood | kay | 20:17 |
aelkner | ok | 20:17 |
Makorihi | so the browser.py is automatically reconized and used? | 20:18 |
pcardune | so, in order to change data on the context object, we have to remove the security proxy | 20:18 |
Lumiere | Makorihi: any py change will require a zope restart | 20:18 |
pcardune | Makorihi, no, zope is a very explicit system, we have not connected browser.py to everything else yet | 20:18 |
pcardune | we will do that in a second | 20:18 |
pcardune | so now edit the configure.zcml file | 20:19 |
tehminkeh | wow, i didnt see that coming | 20:19 |
Makorihi | and is it recommended to have a folder called browser with all the webinterface files? | 20:19 |
pcardune | Makorihi, eventually | 20:19 |
pcardune | when we have a lot of web interface files | 20:20 |
pcardune | but for now since we only have a couple, it is easier to just leave them in the same place | 20:20 |
pcardune | so, in configure.zcml you are going to add an attribute to the first browser:page tag | 20:20 |
pcardune | (the one for index.html) | 20:20 |
pcardune | add this attribute: class="zcontact.browser.ContactView" | 20:20 |
pcardune | so it should look like: | 20:20 |
pcardune | <browser:page | 20:20 |
pcardune | for="zcontact.interfaces.IContact" | 20:20 |
pcardune | name="index.html" | 20:20 |
pcardune | permission="zope.View" | 20:20 |
pcardune | template="viewcontact.pt" | 20:20 |
pcardune | class="zcontact.browser.ContactView" | 20:20 |
pcardune | /> | 20:21 |
pcardune | when we specify a class attribute, zope will create an instance of the class (in effect running the __init__ method) before it generated the html from the page template | 20:21 |
Makorihi | do we have to crease a seperate class in browser.py for EVERY class that can be updated through the web? | 20:21 |
pcardune | no, but we'll get to that later | 20:22 |
pcardune | that is good foreshadowing Makorihi :) | 20:22 |
pcardune | we specify this attribute for the index.html page and not for edit.html because the action in our form sends us to index.html so index.html needs to process the data | 20:23 |
pcardune | you will have to restart your zope server once again (sorry) | 20:23 |
Lumiere | arrrrrrgh :) | 20:23 |
pcardune | but now you should be able to enter in information and it should actually work! | 20:24 |
Lumiere | works | 20:24 |
mlinnell | for me it says "A system error occurred." when you click save | 20:24 |
pcardune | mlinnell, then you probably entered something in wrong | 20:25 |
pcardune | check the shell where you have your zope server running and it should give you a python traceback | 20:25 |
mattva01 | works for me | 20:25 |
mlinnell | k let me see | 20:25 |
tehminkeh | If i have SAVE in the url | 20:26 |
tehminkeh | and random garbage | 20:26 |
tehminkeh | it clears the lastname attribute | 20:26 |
tehminkeh | shouldn't that not be the case? | 20:26 |
pcardune | tehminkeh, no, it should be the case (that may not be how you want it to behave, but that is how we have programmed it to behave) | 20:26 |
pcardune | if you just put the SAVE in the url, then it will look for the lastName attribute, if it doesn't find it, it returns an empty string which then gets stored in the lastName attribute | 20:27 |
tehminkeh | yeah, so how would we make it not behave like that | 20:27 |
pcardune | well, you would just change the browser view class | 20:28 |
tehminkeh | how do we make it do nothing unless there is lastName and SAVE | 20:28 |
tehminkeh | how though? | 20:28 |
Makorihi | well | 20:28 |
Makorihi | in the browser.py | 20:28 |
Lumiere | you just check the browser.py | 20:28 |
tehminkeh | no, I know | 20:28 |
pcardune | you might say if request.has_key('lastName'): context.lastName = request.get('lastName') | 20:28 |
tehminkeh | but what would the code be | 20:28 |
Makorihi | ya | 20:28 |
tehminkeh | oh | 20:28 |
tehminkeh | thanx pcardune | 20:28 |
pcardune | or you could put even more shortly, context.lastName = request.get('lastName',context.lastName) | 20:29 |
pcardune | that has the same effect | 20:29 |
pcardune | so we are *almost* done | 20:30 |
pcardune | after putting something in for the lastName, and verifying that it is in fact stored, I want you to restart your zope server once again | 20:30 |
pcardune | and go to the zcontact object created... you should have something of a surprise, kudos to the first person who notices it | 20:31 |
Makorihi | it takes such a long time to load the pages | 20:32 |
Makorihi | not the index and edit | 20:32 |
Makorihi | but the zope web interface | 20:32 |
kjcole | Proving my cluelessness: I've been ignoring things like not being able to see the object view, and needing to go into preview. Somewhere, I've apparently missed some linkages. | 20:33 |
aelkner | mlinnell: are you doing better now? | 20:33 |
pcardune | If you guys want zope to run faster, you might try to figure out how to install it on your own computer | 20:33 |
aelkner | WE need a wiki for that. | 20:33 |
pcardune | then you wouldn't have to use maddog | 20:33 |
Makorihi | i'll do that | 20:33 |
tehminkeh | lastName is still stored | 20:33 |
pcardune | but be warned: if you install it on your own computer, I can't help you debug the install | 20:33 |
Lumiere | ooh | 20:34 |
Lumiere | the last name isn't kept? | 20:34 |
pcardune | right | 20:34 |
mlinnell | aelkner: working now; forgot the import line in the browser.py | 20:34 |
pcardune | suddenly our lastName has disappeared!!! | 20:34 |
tehminkeh | why is that a surprise? | 20:34 |
pcardune | ok, maybe it's not a surprise | 20:34 |
Makorihi | mine didnt dissapear | 20:35 |
Lumiere | cause we didn't explicitly store it? | 20:35 |
tehminkeh | mine didnt at first | 20:35 |
Lumiere | Makorihi: hard refresh | 20:35 |
Lumiere | ;) | 20:35 |
pcardune | make sure you aren't looking at a cache | 20:35 |
Makorihi | ctrl + F4 | 20:35 |
Makorihi | no | 20:35 |
Makorihi | F5 | 20:35 |
pcardune | we did explicitly store it, but our Contact class is not persistent | 20:35 |
Lumiere | pcardune: ah | 20:36 |
pcardune | If a class is not persistent, then all the data stored in it will disappear when zope gets restarted | 20:36 |
Makorihi | were we suppose to store an empty string into the lastname? | 20:36 |
pcardune | As our last step of the day, we will make it persistent | 20:36 |
tehminkeh | woot! | 20:36 |
pcardune | Makorihi, where? | 20:36 |
pcardune | Makorihi, do you mean through the web? in the code? | 20:37 |
Makorihi | the web | 20:37 |
pcardune | Makorihi, no, you were supposed to enter in some random name... then restart the server | 20:37 |
Makorihi | oh | 20:37 |
Makorihi | oh | 20:37 |
Makorihi | okay | 20:37 |
Makorihi | i get it | 20:37 |
Makorihi | it all makes sense now.... | 20:37 |
pcardune | anyhow, open up the contact.py file now | 20:37 |
tehminkeh | is there a way to make the computer stop being dumb, and realize that when i say <a href="./edit.html"> i mean relative to the current file im in and not the current url | 20:38 |
Makorihi | no | 20:38 |
Makorihi | not ./ | 20:38 |
Makorihi | just edit.html | 20:38 |
tehminkeh | yeah | 20:38 |
tehminkeh | that doesnt work either | 20:38 |
tehminkeh | if im at | 20:38 |
tehminkeh | zcontact/ | 20:38 |
tehminkeh | it takes me to the right place | 20:38 |
tehminkeh | but if im at | 20:38 |
tehminkeh | zcontact no slash | 20:38 |
tehminkeh | it tries to put me at edit.html from the top dir | 20:38 |
*** jfroche has joined #schooltool | 20:39 | |
Makorihi | does just / work? | 20:39 |
Makorihi | without the . | 20:39 |
tehminkeh | lemme test | 20:39 |
tehminkeh | i very much doubt it | 20:39 |
Lumiere | it should be "edit.html" | 20:39 |
Lumiere | nothing else | 20:39 |
pcardune | tehminkeh, you could say <a tal:attributes="href string:${context/@@absoluteURL}/edit.html">Edit</a> | 20:39 |
Lumiere | hi jfroche | 20:39 |
pcardune | but we will get to what all that means later :) | 20:40 |
tehminkeh | yes it is just edit.html | 20:40 |
tehminkeh | but that misbehaves based on the URL | 20:40 |
pcardune | so open up contact.py and at the top i want you to import persistent | 20:40 |
kjcole | should we have to say all that? It seems that some people are getting things working with just "edit.html" and others are not... But theoretically we're all doing the same thing, right? | 20:41 |
Makorihi | just persistent? | 20:41 |
Makorihi | not zope.persistent | 20:41 |
pcardune | Makorihi, just persistent | 20:41 |
pcardune | it should be edit.html, tehminkeh is just fooling around with the URLs in a way that normal end users wouldn't do | 20:41 |
tehminkeh | actually I'm not | 20:41 |
jfroche | hello Lumiere | 20:42 |
tehminkeh | I think it must be a problem with the new firefox | 20:42 |
tehminkeh | when i click the zcontact object | 20:42 |
tehminkeh | it goes to | 20:42 |
kjcole | Mine doesn't resolve either. | 20:42 |
tehminkeh | blah/zcontact | 20:42 |
tehminkeh | and i click it | 20:42 |
pcardune | really? | 20:42 |
tehminkeh | and it tries to go to blah/edit.html | 20:42 |
tehminkeh | however | 20:42 |
tehminkeh | if im at | 20:42 |
tehminkeh | blah/zcontact/ | 20:42 |
tehminkeh | i click it | 20:42 |
tehminkeh | and it goes to | 20:42 |
tehminkeh | blah/zcontact/edit.html | 20:42 |
tehminkeh | which is bizarre | 20:42 |
tehminkeh | is it firefox's problem? | 20:42 |
tehminkeh | cuz it seems like it would be | 20:43 |
pcardune | tehminkeh, don't type in URLs, just navigate with the links available to you from the ZMI | 20:43 |
tehminkeh | yeah | 20:43 |
Makorihi | in zope, can you store things for sessions? | 20:43 |
tehminkeh | using those links | 20:43 |
tehminkeh | it breaks | 20:43 |
tehminkeh | it only works when i explicity add the slash | 20:43 |
tehminkeh | when i click from the ZMI | 20:43 |
tehminkeh | it takes me to | 20:43 |
tehminkeh | blah/zcontact/ | 20:44 |
nitromaster | persistent is pretty sweet...but it's only with one user right? | 20:44 |
tehminkeh | *blah/zcontact | 20:44 |
tehminkeh | which breaks the link | 20:44 |
tehminkeh | i have to type it out | 20:44 |
tehminkeh | to make it work | 20:44 |
pcardune | tehminkeh, try going to blah/manage and then clicking on the links | 20:44 |
Makorihi | why is there an edit.html in your root directory? | 20:44 |
tehminkeh | there isnt | 20:44 |
pcardune | nitromaster, nope, it is with all users | 20:44 |
Lumiere | it's for the contact object | 20:45 |
nitromaster | pcardune: that stinks....are we gonna change that? | 20:45 |
pcardune | nitromaster, why does that stink? | 20:45 |
tehminkeh | yup pcardune | 20:45 |
tehminkeh | clicking the links breaks | 20:45 |
tehminkeh | it only works | 20:45 |
tehminkeh | when i explicity type | 20:46 |
nitromaster | pardune: becuase if i want my zcontacts, and you want yours, on the same computer, there's gonna be a problem | 20:46 |
pcardune | well tehminkeh, I don't know what to say... it works for me | 20:46 |
tehminkeh | which browser are you using? | 20:46 |
pcardune | nitromaster, oh, that is what you mean.... yes we will change that | 20:46 |
pcardune | tehminkeh, firefox2.0 | 20:46 |
tehminkeh | like | 20:46 |
pcardune | tehminkeh, I will refer you to #cando-help, we need to move on with this persistent stuff | 20:47 |
tehminkeh | ok | 20:47 |
pcardune | and your problem is not a show stopper | 20:47 |
pcardune | so, back to this persistent stuff | 20:47 |
pcardune | put import persistent at the top of contact.py | 20:47 |
pcardune | and then make the Contact class inherit from persistent.Persistent | 20:47 |
pcardune | the whole file should look something like this now: | 20:48 |
pcardune | import zope.interface | 20:48 |
pcardune | import persistent | 20:48 |
pcardune | import interfaces | 20:48 |
pcardune | class Contact(persistent.Persistent): | 20:48 |
pcardune | """Implementation of IContact""" | 20:48 |
pcardune | zope.interface.implements(interfaces.IContact) | 20:48 |
pcardune | lastName = u'' | 20:48 |
lisppaste5 | kjcole pasted "my story so far..." at http://paste.lisp.org/display/35998 | 20:48 |
Lumiere | pcardune: shouldn't it be Contact(object, persistent.Persistent) | 20:48 |
Makorihi | my contact is not an object | 20:49 |
pcardune | Lumiere, no because persistent.Persistent inherits from object | 20:49 |
Lumiere | ok | 20:49 |
Makorihi | so, will this store the data in files? | 20:49 |
pcardune | sort of | 20:49 |
pcardune | it stores the data in the ZODB which stands for Z Object DataBase | 20:50 |
Lumiere | which is the Data.fs file | 20:50 |
pcardune | the entire ZODB is stored in just one file: Data.fs | 20:50 |
tehminkeh | that sounds like bad design | 20:51 |
tehminkeh | it just screams windows registry at me | 20:51 |
Makorihi | ya | 20:51 |
Makorihi | one file | 20:51 |
pcardune | Now, when you go and look at your contact object in the ZMI, you might get an error like: TypeError: ('object.__new__(Contact) is not safe, use persistent.Persistent.__new__()', <function _reconstructor at 0xb7deded4>, (<class 'zcontact.contact.Contact'>, <type 'object'>, None)) | 20:51 |
Makorihi | means that you will have to open the whole file every time | 20:51 |
pcardune | Makorihi, no, not exactly... a lot of data base systems store everything in one file | 20:52 |
aelkner | sql for instance | 20:52 |
pcardune | you can do multiple files but we don't need to do that since we are not hosting google.com | 20:52 |
Lumiere | most sql systems store it this way, because it has faster access | 20:52 |
Makorihi | okay | 20:52 |
Makorihi | because | 20:52 |
Makorihi | if you had a database that big | 20:52 |
Makorihi | and you wanted to query a small string | 20:52 |
Lumiere | zope can run with a db over 2G with no problem | 20:52 |
Lumiere | if the system can do it | 20:52 |
Lumiere | (I run production zope servers) | 20:53 |
nitromaster | pcardune: my zope instance won't even start because of the error you have there. it works find if contact doesn't inherit from persistent.Persistent though... | 20:53 |
pcardune | nitromaster, right | 20:53 |
pcardune | this is the problem with inheriting from persistent.Persistent after you already have an object in the database | 20:54 |
pcardune | I wanted to do it in this order so you would directly see the peril of adding persistence later | 20:54 |
pcardune | it is normally the first thing that you do | 20:54 |
Makorihi | so | 20:54 |
Makorihi | how do you delete it? | 20:54 |
pcardune | so, to get it to work, you have to undo the persistence bit in the contact.py | 20:55 |
Makorihi | but i mean | 20:55 |
pcardune | i.e. dont have Contact inherit from persistent.Persistent | 20:55 |
Makorihi | if you want persistence | 20:55 |
Makorihi | you just delete all instances of Contact in Zope | 20:55 |
nitromaster | wow, that stinks | 20:55 |
Makorihi | and then do that? | 20:55 |
pcardune | then go into your zmi, make sure to delete all the isntances of contact in your zope server, then but persistence back in | 20:55 |
pcardune | then put* persistence back in and restart your zope server | 20:56 |
pcardune | yeah, that sure does stink! | 20:56 |
pcardune | which is why there is a solution! | 20:56 |
Makorihi | is there a wa-- okay? | 20:56 |
pcardune | but the solution is somewhat complicated, and it involved things called generation scripts | 20:56 |
tehminkeh | so we should just remove all instances? | 20:56 |
pcardune | yep | 20:56 |
nitromaster | no generation scripts today? | 20:57 |
pcardune | generation scripts will only come up much later | 20:57 |
pcardune | *maybe* over the summer for those of you who become full fledged interns | 20:57 |
Makorihi | umm | 20:57 |
Makorihi | how do we make web pages with drop down menus and dynamic things with zope? do we actually use zope classes/interfaces or do we use somthing like javascript? | 20:58 |
pcardune | Makorihi, well, it depends on what you mean by dynamic | 20:59 |
pcardune | if you are talking about AJAX, you need a combination of javascript and zope stuff | 20:59 |
Makorihi | well, first case would be a drop down menu. second would be a text pad that saves as you type | 20:59 |
pcardune | then yes, you need javascript and that would be AJAX | 20:59 |
Makorihi | and you would just use the AJAX in the .pt files? | 21:00 |
Preetam | um, any more persistent stuff? | 21:00 |
pcardune | "dynamic" though is a much more general term and just means anything that is generated on the fly | 21:00 |
pcardune | Preetam, nope, that is it for persistence | 21:00 |
Makorihi | hmm, then would you call it "superdynamic"? | 21:00 |
pcardune | once you inherit from persistent.Persistent, all he attributes in the object will be automatically stored | 21:00 |
pcardune | yeah, maybe superdynamic | 21:01 |
pcardune | anyways, that concludes our class for today | 21:01 |
pcardune | and takes us through iteration 2 of our user stories (locate here: https://svn.schooltool.org/trac/cando-auth/wiki/ZContact) | 21:01 |
nitromaster | wait...i deleted all my instances of contact, but zope still doesn't start.... (after doing all the steps...) | 21:01 |
*** jfroche has quit IRC | 21:02 | |
* mattva01 claps for pcardune | 21:02 | |
pcardune | nitromaster, what is your error message? | 21:02 |
tehminkeh | $ python contact.py | 21:02 |
tehminkeh | Traceback (most recent call last): | 21:02 |
tehminkeh | File "contact.py", line 3, in ? | 21:02 |
tehminkeh | import persistent | 21:02 |
tehminkeh | ImportError: No module named persisten | 21:02 |
tehminkeh | there is a t on the end of that output | 21:03 |
tehminkeh | i didnt copy it | 21:03 |
nitromaster | error: TypeError: ('object.__new__(Contact) is not safe, use persistent.Persistent.__new__()', <function _reconstructor at 0xf7d4c570>, (<class 'zcontact.contact.Contact'>, <type 'object'>, None)) | 21:03 |
kjcole | PYTHONPATH ? | 21:03 |
Makorihi | i just say from persistent import Persistent | 21:03 |
pcardune | nitromaster, hmm, hang around after class and we'll see what we can do | 21:03 |
nitromaster | sure | 21:03 |
pcardune | next week we will be doing iteration 3 | 21:04 |
mattva01 | sounds good | 21:04 |
Makorihi | cool | 21:04 |
mattva01 | back to World of Warcraft for me :) | 21:04 |
eldafar | wow sucks | 21:04 |
Makorihi | pcardune: thanks for your time | 21:04 |
eldafar | it's the bane of all mmo's | 21:04 |
pcardune | thanks for coming and I hope you all learned a lot | 21:04 |
mlinnell | pcardune: thanks | 21:04 |
eldafar | lol | 21:04 |
kjcole | Off to "Taste of India" for me. ;-) | 21:05 |
pcardune | I'll see you next week | 21:05 |
kjcole | Thanks Paul | 21:05 |
pcardune | feel free to hang around if you have questions | 21:05 |
*** tehminkeh has quit IRC | 21:05 | |
*** Mounika has quit IRC | 21:05 | |
*** mgarlapa has quit IRC | 21:05 | |
kjcole | In that case, I'll put off lunch and hang for a bit. | 21:05 |
*** Preetam has left #schooltool | 21:05 | |
nitromaster | so do you know why my zope intance didn't work? | 21:06 |
*** mattva01 is now known as mattva01|WoW | 21:06 | |
Makorihi | how does you import statement look like? | 21:07 |
pcardune | nitromaster, send me the code you have for contact.py | 21:07 |
nitromaster | i did | 21:07 |
pcardune | are you registered on freenode? if not you can't send private messages | 21:08 |
nitromaster | ohhh | 21:08 |
nitromaster | sorry | 21:08 |
nitromaster | import zope.interface | 21:08 |
nitromaster | import persistent | 21:08 |
nitromaster | import interfaces | 21:08 |
nitromaster | class Contact(persistent.Persistent): | 21:08 |
nitromaster | """Implementation of IContact""" | 21:08 |
nitromaster | zope.interface.implements(interfaces.IContact) | 21:08 |
nitromaster | lastName = u'' | 21:08 |
nitromaster | i guess i'll register | 21:08 |
pcardune | ok, the only thing I can think of is that all the instances of contact are not deleted | 21:09 |
pcardune | what is the url to your web server? | 21:09 |
nitromaster | http://maddog.yhspatriot.net:8101/ | 21:09 |
nitromaster | but its down | 21:09 |
nitromaster | since zope can't start... | 21:09 |
nitromaster | should i take out persistent, and start it? | 21:10 |
pcardune | nitromaster, yes | 21:10 |
*** mattva01|WoW has quit IRC | 21:11 | |
nitromaster | ok, its up | 21:11 |
pcardune | what is hello_test | 21:11 |
nitromaster | nothin | 21:12 |
nitromaster | i just was testing it out two days ago | 21:12 |
pcardune | well, the last thing I can suggest is that you delete the file in zope3/var/Data.fs | 21:12 |
nitromaster | everything there is useless | 21:12 |
nitromaster | ok | 21:12 |
pcardune | that will delete everything in the database | 21:12 |
nitromaster | now restart? | 21:12 |
pcardune | yeah | 21:12 |
nitromaster | ok | 21:13 |
nitromaster | should i add persistent now? | 21:13 |
pcardune | yes | 21:13 |
nitromaster | nice, it works! | 21:15 |
nitromaster | thanks | 21:16 |
kjcole | OK, now me. | 21:16 |
kjcole | I gather that some people were seeing this Object view (or whatever it was)... | 21:16 |
Lumiere | yea | 21:17 |
kjcole | Object Introspector... That was my first issue of the class, I think. | 21:17 |
Lumiere | mine too | 21:18 |
pcardune | what was the issue? | 21:18 |
Lumiere | we get a registration page | 21:18 |
Lumiere | instead of the Introspector | 21:18 |
kjcole | That we're not seeing it. We get a registration page. | 21:18 |
*** nitromaster has quit IRC | 21:19 | |
pcardune | well, there are a lot of different reasons why that might happen | 21:19 |
pcardune | reasons that I myself haven't looked into at all | 21:19 |
pcardune | mostly, it isn't really important at all as we will eventually be overridding all of that stuff in the future | 21:19 |
pcardune | at least, that is why I have never really looked into it much | 21:20 |
kjcole | It makes me a bit nervous when I start from your tarball, and get something unexpected, and others don't. (Maybe I should have stuck with what I had there, but I wanted to be sure I was starting on the same page.) | 21:20 |
*** AVN` has joined #schooltool | 21:21 | |
*** Makorihi has quit IRC | 21:21 | |
AVN` | is today the class, or did I miss it? | 21:21 |
kjcole | Was the class. | 21:21 |
pcardune | it ended about 20 minutes ago | 21:21 |
AVN` | darn | 21:21 |
pcardune | but you can read the logs | 21:21 |
AVN` | where? | 21:21 |
pcardune | http://schooltool.pov.lt/irclogs/%23schooltool.2007-01-27.log.html | 21:22 |
kjcole | Next question. (Or should I ask in #cando-help?) I was having similar issues regarding the link between index.html and edit.html. | 21:22 |
AVN` | I was cleaning,.. lol, forgot about the class | 21:22 |
Lumiere | just ask here | 21:23 |
Lumiere | cando-help was just to pull it outta the chat | 21:23 |
pcardune | AVN`, that's ok, the official lesson write up will be available in the next few days | 21:23 |
kjcole | clicking the link off of my index page leads me to | 21:23 |
pcardune | just make sure you follow it and understand everything | 21:23 |
pcardune | kjcole, yeah, we specified the url for the edit page over simply | 21:23 |
pcardune | it should really be specified dynamically using tals | 21:24 |
kjcole | "The page that you are trying to access is not available" | 21:24 |
pcardune | as in tal:attributes="href string:${context/@@absoluteURL}/edit.html" | 21:24 |
kjcole | OK, maybe things were just going by a bit fast for this slow reader. I'll review the log and see if I can make better sense at my reading speed. | 21:25 |
pcardune | we didn't do that last tal bit because I didn't want to explain string: and @@absoluteURL just yet | 21:25 |
t3h_sood | *does the happy dance* finally up to date. Thanks! | 21:28 |
kjcole | OK, since I'm logging this privately as well, I'm going to sign off and hope there aren't any earth-shaking revelations after I've signed off. ;-) | 21:29 |
*** nitromaster has joined #schooltool | 21:29 | |
pcardune | i'm going to be leaving too | 21:29 |
t3h_sood | I biddeth thee good farewell | 21:30 |
pcardune | bye all | 21:30 |
*** pcardune has left #schooltool | 21:31 | |
*** nitromaster has left #schooltool | 21:31 | |
t3h_sood | <_< bye peoples | 21:32 |
*** t3h_sood has left #schooltool | 21:32 | |
kjcole | Ta-ta. | 21:32 |
*** kjcole has quit IRC | 21:33 | |
*** aelkner has quit IRC | 21:33 | |
*** bnguyen has quit IRC | 21:42 | |
*** jinty has quit IRC | 21:43 | |
*** mlinnell has quit IRC | 21:43 | |
AVN` | does indentation matter in zope? | 22:05 |
eldafar | yes | 22:06 |
AVN` | oh | 22:07 |
AVN` | is there an easy scheme? | 22:07 |
eldafar | for what type of file? | 22:07 |
eldafar | .py, zcml, or .pt? | 22:07 |
AVN` | zcml | 22:07 |
eldafar | usually, it's 2 spaces for sub tabs | 22:09 |
eldafar | or that's the convention we use | 22:09 |
AVN` | ok | 22:10 |
AVN` | How do I access the ZMI for my zope instance? | 22:19 |
eldafar | did you start it? | 22:19 |
AVN` | yes | 22:20 |
AVN` | I got some errors though | 22:20 |
AVN` | warnings | 22:20 |
AVN` | but it says it started | 22:20 |
eldafar | like? | 22:20 |
eldafar | ok | 22:20 |
AVN` | UserWarning: You did not specify an i18n translation domain for the 'title' field in /home/cbeacham/lib/python/zcontact/configure.zcml | 22:20 |
eldafar | maddog.yhspatriot.net:yourportnumber/ | 22:20 |
eldafar | which should be shown to you when you start the instance | 22:21 |
eldafar | the port number that is | 22:21 |
AVN` | I get this error in my browser | 22:21 |
AVN` | UserWarning: You did not specify an i18n translation domain for the 'title' field in /home/cbeacham/lib/python/zcontact/configure.zcml | 22:21 |
AVN` | wait | 22:21 |
AVN` | The address type is unknown or unsupported | 22:22 |
AVN` | maddog.yhspatriot.net:8121/ | 22:22 |
eldafar | http://maddog.yhspatriot.net:8121/ works fine for me | 22:22 |
AVN` | I see that | 22:23 |
AVN` | I can see you accessing it | 22:23 |
AVN` | maybe it doesn't work with opera? | 22:23 |
AVN` | oh | 22:23 |
AVN` | I guess I needed http | 22:23 |
AVN` | thanks | 22:24 |
eldafar | no problem | 22:28 |
*** AVN` has quit IRC | 22:45 | |
*** AVN` has joined #schooltool | 22:47 | |
*** AVN` has quit IRC | 22:51 | |
*** whaddon has joined #schooltool | 22:54 | |
eldafar | whaddon: hey | 22:56 |
whaddon | Hi Eldar | 22:57 |
eldafar | ok, login to bonnieb | 22:58 |
whaddon | I actually never got an account on bonnieb | 22:59 |
eldafar | and screen -x | 22:59 |
eldafar | no, log in as me | 22:59 |
eldafar | I got scolded by Paul for re-adding quiz module :P | 23:01 |
*** AVN` has joined #schooltool | 23:04 | |
AVN` | eldafar, I can't see what the pt file is supposed to do | 23:05 |
AVN` | I can't see the effect | 23:05 |
AVN` | maybe its not working | 23:05 |
eldafar | which .pt file? | 23:05 |
AVN` | the first one we made during the lesson | 23:05 |
eldafar | index.html? | 23:05 |
eldafar | hold on | 23:06 |
AVN` | viewcontent.pt, i think | 23:06 |
eldafar | i forgot its name | 23:06 |
eldafar | oh ok | 23:06 |
eldafar | PM me the contents of your viewcontent.pt | 23:06 |
eldafar | what does your viewcontent.pt look like? | 23:07 |
AVN` | I pmed it to you | 23:08 |
AVN` | <html> | 23:08 |
AVN` | <body> | 23:08 |
AVN` | <h1>Zope Contact</h1> | 23:08 |
AVN` | <h3>Last Name <b tal:content="content/lastName">last name </b> </h3> | 23:08 |
AVN` | </body> | 23:08 |
AVN` | </html> | 23:08 |
eldafar | ok, is there a problem with it? | 23:10 |
eldafar | if you configured it properly, then when you access the contact object | 23:11 |
eldafar | viewcontent.pt should be invoked | 23:11 |
AVN` | how do I access it? | 23:11 |
AVN` | he said to click preview | 23:11 |
eldafar | yes, or you can just go directly to the object through its url | 23:12 |
eldafar | http://maddog.yhspatriot.net:8121/Lewis | 23:12 |
AVN` | but that just shows the screen you get before you login to the ZMI | 23:12 |
AVN` | oh, it says a system error occured | 23:12 |
eldafar | what's the traceback in your shell? | 23:12 |
AVN` | its very long | 23:13 |
eldafar | the last 3-4 lines usually suffice | 23:14 |
AVN` | File "/usr/local/src/Zope3/src/zope/tales/expressions.py", line 217, in __call__ | 23:15 |
AVN` | return self._eval(econtext) | 23:15 |
AVN` | File "/usr/local/src/Zope3/src/zope/tales/expressions.py", line 194, in _eval | 23:15 |
AVN` | ob = self._subexprs[-1](econtext) | 23:15 |
AVN` | File "/usr/local/src/Zope3/src/zope/tales/expressions.py", line 118, in _eval | 23:15 |
AVN` | ob = vars[base] | 23:15 |
eldafar | oooh | 23:17 |
eldafar | sorry, didn't notice it earlier | 23:17 |
eldafar | ="content/lastName" should be ="context/lastName" | 23:18 |
AVN` | oh | 23:22 |
eldafar | does it work now, you don't have to restart zope when you edit .pt files | 23:22 |
eldafar | ? | 23:22 |
AVN` | oh | 23:25 |
AVN` | I don't have to restart zope? | 23:25 |
eldafar | only when you change .py and .zcml files you restart zope | 23:26 |
eldafar | when you change resources or page templates, you don't have to | 23:27 |
eldafar | resources are things like .css files or images | 23:27 |
AVN` | hmm | 23:28 |
AVN` | system error again | 23:28 |
AVN` | File "/usr/local/src/Zope3/src/zope/app/pagetemplate/simpleviewclass.py", line 44, in __call__ | 23:29 |
AVN` | return self.index(*args, **kw) | 23:29 |
AVN` | File "/usr/local/src/Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py", line 83, in __call__ | 23:29 |
AVN` | return self.im_func(im_self, *args, **kw) | 23:29 |
AVN` | File "/usr/local/src/Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py", line 51, in __call__ | 23:29 |
AVN` | sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0), | 23:29 |
AVN` | File "/usr/local/src/Zope3/src/zope/pagetemplate/pagetemplate.py", line 109, in pt_render | 23:29 |
AVN` | raise PTRuntimeError(str(self._v_errors)) | 23:29 |
AVN` | - Warning: Compilation failed | 23:29 |
AVN` | - Warning: zope.tal.taldefs.TALError: bad TAL attribute: u'context', at line 4, column 16 | 23:29 |
eldafar | oh, you mixed them up again | 23:29 |
eldafar | it should be | 23:29 |
eldafar | <b tal:content="context/lastName"> Last Name </b> | 23:30 |
eldafar | not <b tal:context ....? | 23:30 |
AVN` | content then context | 23:30 |
AVN` | ob = self._traverser(ob, element, econtext) | 23:32 |
AVN` | File "/usr/local/src/Zope3/src/zope/app/pagetemplate/engine.py", line 68, in __call__ | 23:32 |
AVN` | request=request) | 23:32 |
AVN` | File "/usr/local/src/Zope3/src/zope/traversing/adapters.py", line 164, in traversePathElement | 23:32 |
AVN` | return traversable.traverse(nm, further_path) | 23:32 |
AVN` | - __traceback_info__: (<zcontact.contact.Contact object at 0xf626e930>, 'lastName') | 23:32 |
AVN` | File "/usr/local/src/Zope3/src/zope/traversing/adapters.py", line 52, in traverse | 23:32 |
AVN` | raise TraversalError(subject, name) | 23:32 |
AVN` | - __traceback_info__: (<zcontact.contact.Contact object at 0xf626e930>, 'lastName', []) | 23:32 |
eldafar | does your Contact object have a lastName attribute? | 23:33 |
eldafar | try to match your code against the code on the website | 23:33 |
AVN` | oh | 23:35 |
AVN` | its lastname | 23:35 |
AVN` | not lastName | 23:35 |
eldafar | yeh | 23:35 |
AVN` | do I have to restart zope now? | 23:35 |
eldafar | if you only changed .pt no | 23:36 |
eldafar | if you changed something else, yes | 23:36 |
AVN` | ok yes then | 23:36 |
eldafar | so? | 23:38 |
eldafar | any progress? | 23:38 |
AVN` | will ctrl c quit zope? | 23:39 |
eldafar | yes, it will stop it | 23:40 |
AVN` | I see it | 23:41 |
AVN` | doesn't say lewis though | 23:41 |
AVN` | says Last Name | 23:41 |
eldafar | are you sure you set lastName to lewis? | 23:45 |
eldafar | did you make a mistake in your class when writing it? | 23:45 |
eldafar | and named the variable lastname? | 23:45 |
AVN` | I think its not supposed to say anything there yet | 23:47 |
eldafar | yeh, cuz you don't have anything | 23:54 |
eldafar | set for last name | 23:54 |
eldafar | move on to the edit part | 23:54 |
AVN` | k | 23:55 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!