IRC log of #schooltool for Saturday, 2007-01-27

*** Ninno2 has joined #schooltool00:21
*** Ninno has quit IRC00:39
*** jinty has quit IRC01:59
*** wrobel has quit IRC03:16
*** kjcole has joined #schooltool03:18
*** Mounika has joined #schooltool03:19
*** Lumiere changes topic to "SchoolTool development | IRC logs at | Dev meetings Mon, 14:30 UTC (16:30 EET) | Use for pasting | pcardune's Zope class continues Saturday"05:08
*** _kjcole has joined #schooltool05:35
*** kjcole has quit IRC05:47
*** _kjcole has quit IRC07:21
*** Lumiere changes topic to "SchoolTool development | IRC logs at | Dev meetings Mon, 14:30 UTC (16:30 EET) | Use for pasting | pcardune's Zope class continues Saturday noon US/Eastern"07:31
*** Z3R0 has joined #schooltool09:41
*** Ninno2 has quit IRC10:13
*** jinty has joined #schooltool11:33
*** kjcole has joined #schooltool15:40
*** th1a_ has quit IRC15:45
*** Aiste has quit IRC15:45
*** didymo has quit IRC15:45
*** Aim2 has quit IRC15:45
*** Aim2 has joined #schooltool15:47
*** th1a_ has joined #schooltool15:47
*** Aiste has joined #schooltool15:47
*** didymo has joined #schooltool15:47
*** t3h_sood has joined #schooltool18:15
*** Preetam has joined #schooltool18:32
*** Preetam has left #schooltool18:33
*** bnguyen has joined #schooltool18:34
*** nitromaster has joined #schooltool18:36
*** mlinnell has joined #schooltool18:36
*** Makorihi has joined #schooltool18:38
*** pcardune has joined #schooltool18:45
*** mattva01 has joined #schooltool18:45
*** aelkner has joined #schooltool18:48
t3h_soodAnd the silence is broken.18:52
aelknerpcarduner: are you tere?18:54
*** tehminkeh has joined #schooltool18:54
*** tehminkeh has left #schooltool18:54
kjcoleaelkner, he's around.  He just sent me a message a minute ago.18:55
t3h_soodby the by, that lesson that you e-mailed, at least for me, resulted in a 404...18:55
*** tehminkeh has joined #schooltool18:56
kjcolet3h_sood: for one of the files at the bottom or the whole thing?18:56
t3h_soodevery file at the bottom18:56
*** Mounika has joined #schooltool18:56
kjcolet3h_sood: (There was a list of links to source files, but one of them was broken a few days ago.)18:58
t3h_soodWell, all of them were broken18:58
*** Mounika is now known as mgarlapa18:59
kjcolethe ones at
kjcoleare all working now.18:59
*** Preetam has joined #schooltool18:59
pcarduneOk, it's 12 noon by my clock19:00
pcardunewhich means it is time to start the class19:00
pcarduneis anyone *not* here?19:00
* kjcole is Kevin Cole19:00
t3h_soodit seems that I had went to the wrong link19:00
t3h_soodor something <_<19:00
kjcoleJeff's out saving the world from the Bush administration, so he won't be attending.19:01
pcarduneOk, let's get started19:01
pcarduneif you haven't already, log into maddog19:02
pcarduneand start up your zope server19:02
t3h_soodthat'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_soodoh, sorry19:02
pcardunelet's cover a bit of what we did in the last lesson19:02
pcarduneLast week we created the file and wrote our first interface: IContact.19:03
tehminkehkjcole: what's he doing?19:03
pcarduneRecall 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
pcarduneWe also went ahead and made an implementation of the IContact interface in the 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
pcarduneHopefully you were all able to get it to work19:05
pcarduneIf not, I recommend you ask each other for help now, as we will be moving on19:05
pcarduneIf you want to make sure your code works, you can download a tarball of it from here:
pcarduneThat should give you everything we did last week19:05
t3h_soodwhat was the url for the place for us to see what zope's doing? yhspatriot something or another?19:06
tehminkeht3h_sood: maddog@yhspatriot.net19:06
pcardunetehminkeh, that doesn't point to anything19:07
pcarduneso if you didn't already, create an instance of the Contact class through the ZMI19:08
mlinnellwhat's ZMI?19:08
tehminkeht3h_sood:      rofl.....19:08
pcardunethe ZMI stands for Zope Management Interface19:08
pcarduneit is the interface you get when you browse to your running zope server in a web browser19:09
pcardunewhere you can log in as well19:09
pcarduneit looks something like this:
*** Z3R0 has left #schooltool19:10
pcarduneHas anyone not created and instance of the Contact class through the ZMI?19:10
Lumiereme XD19:10
*** Mounika has joined #schooltool19:11
t3h_soodwhere was the listing of port numbers?19:11
Lumiereon the cando wiki19:11
nitromasterwhen you do runzope it will tell you your port number19:12
t3h_soodit told me <_<19:12
pcarduneIf you click on the contact object you have created, what do you get?  (one person answer please)19:12
aelkner Object Introspector:  ( testzcontact )?19:13
pcarduneyes, that's right19:13
pcarduneaelkner, everything is working great for you :)19:13
pcarduneThe object Introspector is the default view you get for all objects19:14
pcarduneit just gives you information about the object you are looking at.19:14
aelknerIf anyone is not getting this, please chime in.19:14
pcarduneBut 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 junk19:14
mlinnellwhere do you click?19:14
tehminkehwhere is the object introspector?19:15
Lumierethe object introspector is the default 'view' for an object19:15
aelknermlinnell: first you need to hit the ZContact Page link in the Add menu to the left.19:16
aelknerThen you fill in the name and hit enter.19:17
aelknerThen you see that name in the folder in the middle.19:17
aelknerClick on that name to view the object.19:17
tehminkehafter I authenticate as the Manager on my zope instance, where do I go to make an instance of Contact?19:17
nitromasterI've got a question, why does is the size for my testzcontact  n/a?19:17
pcardunebecause zope doesn't know how to calculate the size of the object19:18
pcardunesometimes it makes more sense to specify the size of an object in terms other than kb19:18
Makorihiwhen we create the contact and click on the name, are we suppose to get a message saying 'this object is not registered'?19:19
pcardunefor 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 up19:19
pcarduneMakorihi, yeah, that could happen to19:19
nitromasterso the size will show that?  Once it works and all?19:19
pcardunenitromaster, if we set it up that way19:19
pcarduneMakorihi, click on the "Instrospector" tab to see what we are all looking at19:19
mlinnellshould we register the object?19:20
pcardunemlinnell, no, don't do anything yet19:20
pcarduneThe first thing to do is to create a new file called The .pt part stands for Page Template.19:20
Lumierepcardune: there are still a few people that don't see zcontact19:20
Lumiereas something to add19:20
pcarduneIf 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/ directory19:21
Makorihito add zcontact to the list,  you have to addMenuItem in the configure.zcml file19:21
Lumiereand if that isn't it?19:21
pcardunethis file is what we call a "slug" and it tells zope about the zcontact package19:21
pcardunealso don't forget to *restart* your zope server after copying this file19:21
tehminkehafter I login to my zope instance on my browser19:21
tehminkehwhat do i do?19:22
aelknermlinnell: are you getting the Introspector screen now?19:22
Makorihitehminekeh, if everything is working alright, click on 'top' and there should be zcontact in the list on the left19:22
mlinnellaelkner: I can't find the Introspector tab19:22
t3h_soodeverything is copied in19:22
t3h_soodbut I still don't see anything19:22
t3h_soodwhat was the configure.zcml thing supposed to do again?19:23
pcardunet3h_sood, can you give us the url to your zope server19:23
aelknermlinnell: Do you have ZContact Page in your Add menu?19:23
mlinnellaelkner: yes, I clicked that19:23
t3h_soodand no, I don't have that19:23
t3h_soodbecause I forgot where configure is, it's in the zcontact folder, right?19:23
aelknermlinnell: So what do you get when you click on the page you just added?19:24
pcarduneMake sure you follow the directions towards the end of the first lesson:
pcardunewe need to move on, so please try to get everything working19:25
pcarduneand you can message me or aelkner for help19:25
mlinnellaelkner: it says it isn't registered19:25
pcardunemlinnell, it doesn't need to be registered19:25
aelknerclick on the Introspecto tab.19:26
pcardunewe will talk about what "registered" means *much* later19:26
Lumierepcardune: I didn't have the browser info to have a menu item19:26
kjcoleI 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
mlinnellI don't see a Introspecto tab19:26
aelknerpcardune: Aren't people stuck if they don't get the Introspector tab?19:27
pcarduneNot necessarily, It is not vital to what we are about to do19:27
kjcoleThis "default view" you speak of, doesn't happen when I click on what I've added.19:27
pcarduneso just make sure you can click on that link in the Add Menu and that is all that matters at the moment19:27
pcarduneNow I want to talk about page templates19:28
pcarduneAll 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
pcarduneIf 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
pcarduneWith 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
pcarduneZope3 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
pcarduneSo let's start writing a page template and I'll explain how it works as we go. Open up the file for editing and type the following lines:19:30
pcardune  <h1>Z Contact</h1>19:30
pcardune  <h3>Last Name: <b tal:content="context/lastName">last name</b></h3>19:30
tehminkehwhere is
Lumieremake it19:31
Lumierein your zcontact folder19:31
pcarduneright Lumiere19:31
pcarduneAs 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
pcarduneSo, last week we discussed a little bit about namespaces relating to the zcml file19:34
pcardunewe made use of the "browser" name with the browser:addMenuItem tag19:34
pcardunetal is another namespace specific to zope, and within that name space are all the attributes you can use with page templates19:34
pcarduneThis 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
pcarduneWhen zope processes this template and generates the final html page, it will ignore what is already inside the b tag.19:35
nitromasterthen can't we just leave it blank?19:36
eldafarYes, but you can also put something meaningful there, so that when people read it19:36
eldafarthey have an idea of what will be there19:36
pcardunethank you eldafar, that is exactly what I was going to say19:36
Lumiereit's also the default display information19:36
pcardunethe context/lastName part is a tales path expression.19:36
pcarduneThe 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
pcardunein our case, the context is a contact object19:37
Lumiereso 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
pcarduneLumiere, not quite right19:37
pcarduneyou already do have a last name entered, but it is an empty string19:37
pcarduneso the b tag will be filled with an empty string19:37
aelknerpcardune: 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
pcardunethe "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
pcarduneaelkner, correct, that is one of the big reasons why we use ZPT instead of DTML19:38
pcardunethen obviously, the lastName part accesses the lastName attribute of the object.19:39
pcarduneThis expression is the tales equivalent to the expression in python context.lastName.19:39
pcardunewe just use a / instead of a . and we will see why in future lessons19:39
pcarduneso after you created the .pt file you should try opening up in your browser19:40
pcardunethe path would be something like file:///home/pcardune/zope3/lib/python/zcontact/viewcontact.pt19:41
aelknerDoesn't it need to be added to the zcml file first?19:41
kjcolehow? since we're running on maddog?19:41
kjcole(file:/// ain't gonna cut it.)19:42
pcarduneooo... if you are running on maddog, you wont be able to look at the file, unless you use lynx...19:42
pcarduneok, scratch that part then, lets go right on to connect this page template to the contact object through ZCML19:42
Makorihiand links or elinks, no?19:42
pcarduneNow 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
pcarduneMakorihi, anything that works in a teminal really19:43
pcardune  <browser:page19:43
pcardune      for="zcontact.interfaces.IContact"19:43
pcardune      name="index.html"19:43
pcardune      permission="zope.View"19:43
pcardune      template=""19:43
pcardune      />19:43
pcarduneBe sure to put this tag within the configure tags.19:43
pcarduneThe 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
pcarduneFor 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
pcarduneFor that reason we register pages with interfaces.19:45
pcarduneThe 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
tehminkehwhen we make changes like this?19:46
tehminkehdo we have to restart zope19:46
tehminkehto see them19:46
pcardunetehminkeh, yes19:46
pcarduneany time you edit zcml or .py files, you have to restart the zope server19:46
pcarduneyou get used to it...19:46
pcarduneFinally, the template attribute obviously specifies the path to the file where the template is located.19:47
pcarduneWith 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
nitromasterwowsers, everyone is restarting their zope instances and its taking forever19:48
pcardunewhen it has restarted, go back to the ZMI and click on your contact object again19:49
pcarduneand you should get the page template we just created19:49
Makorihiso 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
kjcoleI still get "This object is not yet registered"19:51
pcarduneMakorihi, exactly19:51
Lumierekjcole: use the preview button19:51
nitromasteri can't access it through zope, i have to go  that's the only way it'll work for me19:51
Lumierein the folder above your contact19:51
pcarduneyou could also be explicit and just go to
pcardunewe will worry about *navigation* a bit more later19:52
pcardunethe key thing is that by going to the url you should get the generated html page19:52
pcardune(put in your port number and not nitromaster's19:52
Preetamit is blank after Last Name:19:52
pcarduneyep, we haven't entered anything in for the lastName attribute, it is just an empty string19:53
tehminkehthats pretty nifty19:53
Lumierelol... you haven't seen nifty yet ^^19:54
pcarduneok, but now we want to actually set this lastName attribute right19:54
pcarduneso to do that we are going to have to write another page template file19:54
mattva01ok i see how this all works19:54
pcardunethis time with an html form19:54
pcarduneCreate and edit a new file called and add to it the following lines of code: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
pcarduneFeel free to spice up the html a bit if you don't like my over simplified layouts and stuff19:55
pcarduneI assume you all know about html forms already19:55
pcarduneif you don't ask someone who does19:55
pcarduneThe 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
pcardunen 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
pcarduneEven 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 file19:57
pcardunebut just like tal:content did, whatever is specified for the value attribute will be replaced when the html is actually generated19:57
*** th1a_ has quit IRC19:58
pcarduneAgain we will add another browser:page tag to the configure.zcml file that looks like this:19:58
pcardune  <browser:page19:58
pcardune      for="zcontact.interfaces.IContact"19:58
pcardune      name="edit.html"19:58
pcardune      permission="zope.ManageContent"19:58
pcardune      template=""19:58
pcardune      />19:58
tehminkehhow come you put the /> on its own line for configure and not for the .pt files?19:59
pcardunethe zope.ManageContent permission is given by default to anyone who is logged in19:59
Makorihiits just the style19:59
pcarduneyou can do it either way19:59
Lumieretehminkeh: it's a fairly standard style for lines over 80 characters on xml20:00
pcarduneI'm not always totally consistent with that20:00
Lumiereif you want to remove one of those attributes...20:00
tehminkehthats what i was wondering20:00
Lumiereit is much easier if you don't have to fix the /> every time20:00
Lumiereyou just kill the line20:00
tehminkehyeah, but I was wondering why it didnt apply for the .pt files too20:00
Lumierepage templates follow html conventions more then xml conventions20:01
pcardunehopefully you guys are all ahead of me and have already restarted your zope servers and gone to
Lumiereor are restarting....20:01
Makorihiya, it takes a looooooong time to restart20:01
pcardune(top tells me everyone is restarting)20:01
Makorihieven when nobody else is doing it20:01
pcardunesome folks have been working on ways to speed up the start up time20:02
mlinnellfor me it says:  The page that you are trying to access is not available20:02
tehminkehapparently, they are failing20:02
eldafarwhy don't you go and set things in order then? lol20:03
pcardunetehminkeh, no, we just aren't using their code because it is not part of the zope trunk src yet20:03
Makorihiwhat is an i18n translation domain?20:03
mlinnellnvm, figured it out20:03
tehminkehpcardune: I was just kidding20:03
pcardunetehminkeh, i know20:03
pcarduneMakorihi, the i18n translation domain is for internationalization support20:03
pcardunewe aren't going to be worrying about that until somewhat later20:03
pcarduneok, looks like all the servers have restarted by now20:05
Makorihimine is working20:05
pcarduneyou 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
pcarduneremember, if you change a pt file, you don't have to restart the zope server20:05
tehminkehzope it not cooperating20:06
tehminkehwith looking at the file directly20:06
Makorihihow so?20:06
tehminkehdoesn't show me the index page20:07
*** th1a_ has joined #schooltool20:07
tehminkehyes, tried that too20:07
Lumierehi tom20:07
Makorihiwhat is your port>?20:07
pcardunetehminkeh, when you added the contact object, what did you call it?20:07
Makorihii see it20:08
Makorihiisnt that yours?20:08
tehminkehi see how it works20:08
pcardunethat is what you want to use20:08
Makorihiand you can do20:08
Makorihiif you have it working20:08
tehminkehi did20:08
tehminkehi thought it was20:08
tehminkehlike it was in the filesystem20:08
tehminkehbut you have to go through what you named the object20:09
aelknerpcardune: you might want to explain how zope works based on objects and contexts.20:09
tehminkehso, are we going to make the submit button actually work?20:09
tehminkehor just leave it broken20:09
pcardunetehminkeh, yes20:09
pcarduneso, since the action attribute points to the index.html page, clicking on save is going to send us there20:10
pcardunebut we need to write some code that will actually process the data sent through the web request20:10
pcardunewhen 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
pcardunetake a look at the url that is given when you click on save20:11
pcarduneit has a ?lastName=something on the end of it20:11
pcardunethat is where the data is being passed20:11
Makorihilike php20:11
pcarduneWe need to write what is called a browser view class to process the information entered into the form.20:11
pcarduneCreate and edit a new file called and add the following lines:20:11
pcarduneclass 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 = context20:11
pcardune        self.request = request20:11
pcardune        if self.request.get("SAVE"):20:12
pcardune            context =
pcardune            context.lastName = self.request.get("lastName")20:12
pcarduneTo better understand how this is supposed to work, I will write out what happens in steps:20:12
pcardune   1. User inputs data into form20:13
pcardune   2. User submits data using the Save button20:13
pcardune   3. Data gets sent to the index.html page via the url (looks like http://localhost/contact/index.html?lastName=Whatever20:13
pcardune   4. The browser view class for the index.html page gets instantiated and processes the data, which is stored in a request object20:13
pcardune   5. Finally, the index.html page gets rendered with the updated information20:13
pcardunewhen 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
pcardunethis is why we have to put context and request in the __init__ method (and always in that order)20:14
pcardunethe request object is like a python dictionary20:14
pcardunethe self.request.get("SAVE") checks that we did in fact click on the save button20:15
pcardunethen there is the removeSecurityProxy bit20:15
pcardunenormally, web pages are not allowed to modify the data stored in an object20:15
tehminkehis this code already malicious input safe?20:15
tehminkehdoes zope take care of that?20:16
pcardunethat is, the context is surrounded by a protective wrapper called a security proxy20:16
tehminkehor will it crash with bad input20:16
pcardunetehminkeh, yeah, zope takes care of that20:16
t3h_soodSorry for taking us back about an hour, but, I can't log in, at all.20:16
Lumiereaelkner, t3h_sood can you join #cando-help20:17
Makorihiso the is automatically reconized and used?20:18
pcarduneso, in order to change data on the context object, we have to remove the security proxy20:18
LumiereMakorihi: any py change will require a zope restart20:18
pcarduneMakorihi, no, zope is a very explicit system, we have not connected to everything else yet20:18
pcardunewe will do that in a second20:18
pcarduneso now edit the configure.zcml file20:19
tehminkehwow, i didnt see that coming20:19
Makorihiand is it recommended to have a folder called browser with all the webinterface files?20:19
pcarduneMakorihi, eventually20:19
pcardunewhen we have a lot of web interface files20:20
pcardunebut for now since we only have a couple, it is easier to just leave them in the same place20:20
pcarduneso, in configure.zcml you are going to add an attribute to the first browser:page tag20:20
pcardune(the one for index.html)20:20
pcarduneadd this attribute: class="zcontact.browser.ContactView"20:20
pcarduneso it should look like:20:20
pcardune  <browser:page20:20
pcardune      for="zcontact.interfaces.IContact"20:20
pcardune      name="index.html"20:20
pcardune      permission="zope.View"20:20
pcardune      template=""20:20
pcardune      class="zcontact.browser.ContactView"20:20
pcardune      />20:21
pcardunewhen 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 template20:21
Makorihido we have to crease a seperate class in for EVERY class that can be updated through the web?20:21
pcarduneno, but we'll get to that later20:22
pcardunethat is good foreshadowing Makorihi :)20:22
pcardunewe 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 data20:23
pcarduneyou will have to restart your zope server once again (sorry)20:23
Lumierearrrrrrgh :)20:23
pcardunebut now you should be able to enter in information and it should actually work!20:24
mlinnellfor me it says "A system error occurred." when you click save20:24
pcardunemlinnell, then you probably entered something in wrong20:25
pcardunecheck the shell where you have your zope server running and it should give you a python traceback20:25
mattva01works for me20:25
mlinnellk let me see20:25
tehminkehIf i have SAVE in the url20:26
tehminkehand random garbage20:26
tehminkehit clears the lastname attribute20:26
tehminkehshouldn't that not be the case?20:26
pcardunetehminkeh, 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
pcarduneif 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 attribute20:27
tehminkehyeah, so how would we make it not behave like that20:27
pcardunewell, you would just change the browser view class20:28
tehminkehhow do we make it do nothing unless there is lastName and SAVE20:28
tehminkehhow though?20:28
Makorihiin the browser.py20:28
Lumiereyou just check the browser.py20:28
tehminkehno, I know20:28
pcarduneyou might say if request.has_key('lastName'): context.lastName = request.get('lastName')20:28
tehminkehbut what would the code be20:28
tehminkehthanx pcardune20:28
pcarduneor you could put even more shortly, context.lastName = request.get('lastName',context.lastName)20:29
pcardunethat has the same effect20:29
pcarduneso we are *almost* done20:30
pcarduneafter putting something in for the lastName, and verifying that it is in fact stored, I want you to restart your zope server once again20:30
pcarduneand go to the zcontact object created... you should have something of a surprise, kudos to the first person who notices it20:31
Makorihiit takes such a long time to load the pages20:32
Makorihinot the index and edit20:32
Makorihibut the zope web interface20:32
kjcoleProving 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
aelknermlinnell: are you doing better now?20:33
pcarduneIf you guys want zope to run faster, you might try to figure out how to install it on your own computer20:33
aelknerWE need a wiki for that.20:33
pcardunethen you wouldn't have to use maddog20:33
Makorihii'll do that20:33
tehminkehlastName is still stored20:33
pcardunebut be warned: if you install it on your own computer, I can't help you debug the install20:33
Lumierethe last name isn't kept?20:34
mlinnellaelkner: working now; forgot the import line in the browser.py20:34
pcardunesuddenly our lastName has disappeared!!!20:34
tehminkehwhy is that a surprise?20:34
pcarduneok, maybe it's not a surprise20:34
Makorihimine didnt dissapear20:35
Lumierecause we didn't explicitly store it?20:35
tehminkehmine didnt at first20:35
LumiereMakorihi: hard refresh20:35
pcardunemake sure you aren't looking at a cache20:35
Makorihictrl + F420:35
pcardunewe did explicitly store it, but our Contact class is not persistent20:35
Lumierepcardune: ah20:36
pcarduneIf a class is not persistent, then all the data stored in it will disappear when zope gets restarted20:36
Makorihiwere we suppose to store an empty string into the lastname?20:36
pcarduneAs our last step of the day, we will make it persistent20:36
pcarduneMakorihi, where?20:36
pcarduneMakorihi, do you mean through the web? in the code?20:37
Makorihithe web20:37
pcarduneMakorihi, no, you were supposed to enter in some random name... then restart the server20:37
Makorihii get it20:37
Makorihiit all makes sense now....20:37
pcarduneanyhow, open up the file now20:37
tehminkehis 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 url20:38
Makorihinot ./20:38
Makorihijust edit.html20:38
tehminkehthat doesnt work either20:38
tehminkehif im at20:38
tehminkehit takes me to the right place20:38
tehminkehbut if im at20:38
tehminkehzcontact no slash20:38
tehminkehit tries to put me at edit.html from the top dir20:38
*** jfroche has joined #schooltool20:39
Makorihidoes just / work?20:39
Makorihiwithout the .20:39
tehminkehlemme test20:39
tehminkehi very much doubt it20:39
Lumiereit should be "edit.html"20:39
Lumierenothing else20:39
pcardunetehminkeh, you could say <a tal:attributes="href string:${context/@@absoluteURL}/edit.html">Edit</a>20:39
Lumierehi jfroche20:39
pcardunebut we will get to what all that means later :)20:40
tehminkehyes it is just edit.html20:40
tehminkehbut that misbehaves based on the URL20:40
pcarduneso open up and at the top i want you to import persistent20:40
kjcoleshould 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
Makorihijust persistent?20:41
Makorihinot zope.persistent20:41
pcarduneMakorihi, just persistent20:41
pcarduneit should be edit.html, tehminkeh is just fooling around with the URLs in a way that normal end users wouldn't do20:41
tehminkehactually I'm not20:41
jfrochehello Lumiere20:42
tehminkehI think it must be a problem with the new firefox20:42
tehminkehwhen i click the zcontact object20:42
tehminkehit goes to20:42
kjcoleMine doesn't resolve either.20:42
tehminkehand i click it20:42
tehminkehand it tries to go to blah/edit.html20:42
tehminkehif im at20:42
tehminkehi click it20:42
tehminkehand it goes to20:42
tehminkehwhich is bizarre20:42
tehminkehis it firefox's problem?20:42
tehminkehcuz it seems like it would be20:43
pcardunetehminkeh, don't type in URLs, just navigate with the links available to you from the ZMI20:43
Makorihiin zope, can you store things for sessions?20:43
tehminkehusing those links20:43
tehminkehit breaks20:43
tehminkehit only works when i explicity add the slash20:43
tehminkehwhen i click from the ZMI20:43
tehminkehit takes me to20:43
nitromasterpersistent is pretty sweet...but it's only with one user right?20:44
tehminkehwhich breaks the link20:44
tehminkehi have to type it out20:44
tehminkehto make it work20:44
pcardunetehminkeh, try going to blah/manage and then clicking on the links20:44
Makorihiwhy is there an edit.html in your root directory?20:44
tehminkehthere isnt20:44
pcardunenitromaster, nope, it is with all users20:44
Lumiereit's for the contact object20:45
nitromasterpcardune: that stinks....are we gonna change that?20:45
pcardunenitromaster, why does that stink?20:45
tehminkehyup pcardune20:45
tehminkehclicking the links breaks20:45
tehminkehit only works20:45
tehminkehwhen i explicity type20:46
nitromasterpardune: becuase if i want my zcontacts, and you want yours, on the same computer, there's gonna be a problem20:46
pcardunewell tehminkeh, I don't know what to say... it works for me20:46
tehminkehwhich browser are you using?20:46
pcardunenitromaster, oh, that is what you mean.... yes we will change that20:46
pcardunetehminkeh, firefox2.020:46
pcardunetehminkeh, I will refer you to #cando-help, we need to move on with this persistent stuff20:47
pcarduneand your problem is not a show stopper20:47
pcarduneso, back to this persistent stuff20:47
pcarduneput import persistent at the top of contact.py20:47
pcarduneand then make the Contact class inherit from persistent.Persistent20:47
pcardunethe whole file should look something like this now:20:48
pcarduneimport zope.interface20:48
pcarduneimport persistent20:48
pcarduneimport interfaces20:48
pcarduneclass Contact(persistent.Persistent):20:48
pcardune    """Implementation of IContact"""20:48
pcardune    zope.interface.implements(interfaces.IContact)20:48
pcardune    lastName = u''20:48
lisppaste5kjcole pasted "my story so far..." at
Lumierepcardune: shouldn't it be Contact(object, persistent.Persistent)20:48
Makorihimy contact is not an object20:49
pcarduneLumiere, no because persistent.Persistent inherits from object20:49
Makorihiso, will this store the data in files?20:49
pcardunesort of20:49
pcarduneit stores the data in the ZODB which stands for Z Object DataBase20:50
Lumierewhich is the Data.fs file20:50
pcardunethe entire ZODB is stored in just one file: Data.fs20:50
tehminkehthat sounds like bad design20:51
tehminkehit just screams windows registry at me20:51
Makorihione file20:51
pcarduneNow, 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 ''>, <type 'object'>, None))20:51
Makorihimeans that you will have to open the whole file every time20:51
pcarduneMakorihi, no, not exactly... a lot of data base systems store everything in one file20:52
aelknersql for instance20:52
pcarduneyou can do multiple files but we don't need to do that since we are not hosting google.com20:52
Lumieremost sql systems store it this way, because it has faster access20:52
Makorihiif you had a database that big20:52
Makorihiand you wanted to query  a small string20:52
Lumierezope can run with a db over 2G with no problem20:52
Lumiereif the system can do it20:52
Lumiere(I run production zope servers)20:53
nitromasterpcardune: 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
pcardunenitromaster, right20:53
pcardunethis is the problem with inheriting from persistent.Persistent after you already have an object in the database20:54
pcarduneI wanted to do it in this order so you would directly see the peril of adding persistence later20:54
pcarduneit is normally the first thing that you do20:54
Makorihihow do you delete it?20:54
pcarduneso, to get it to work, you have to undo the persistence bit in the contact.py20:55
Makorihibut i mean20:55
pcardunei.e. dont have Contact inherit from persistent.Persistent20:55
Makorihiif you want persistence20:55
Makorihiyou just delete all instances of Contact in Zope20:55
nitromasterwow, that stinks20:55
Makorihiand then do that?20:55
pcardunethen go into your zmi, make sure to delete all the isntances of contact in your zope server, then but persistence back in20:55
pcardunethen put* persistence back in and restart your zope server20:56
pcarduneyeah, that sure does stink!20:56
pcardunewhich is why there is a solution!20:56
Makorihiis there a wa-- okay?20:56
pcardunebut the solution is somewhat complicated, and it involved things called generation scripts20:56
tehminkehso we should just remove all instances?20:56
nitromasterno generation scripts today?20:57
pcardunegeneration scripts will only come up much later20:57
pcardune*maybe* over the summer for those of you who become full fledged interns20:57
Makorihihow 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
pcarduneMakorihi, well, it depends on what you mean by dynamic20:59
pcarduneif you are talking about AJAX, you need a combination of javascript and zope stuff20:59
Makorihiwell, first case would be a drop down menu. second would be a text pad that saves as you type20:59
pcardunethen yes, you need javascript and that would be AJAX20:59
Makorihiand you would just use the AJAX in the .pt files?21:00
Preetamum, any more persistent stuff?21:00
pcardune"dynamic" though is a much more general term and just means anything that is generated on the fly21:00
pcardunePreetam, nope, that is it for persistence21:00
Makorihihmm, then would you call it "superdynamic"?21:00
pcarduneonce you inherit from persistent.Persistent, all he attributes in the object will be automatically stored21:00
pcarduneyeah, maybe superdynamic21:01
pcarduneanyways, that concludes our class for today21:01
pcarduneand takes us through iteration 2 of our user stories (locate here:
nitromasterwait...i deleted all my instances of contact, but zope still doesn't start.... (after doing all the steps...)21:01
*** jfroche has quit IRC21:02
* mattva01 claps for pcardune21:02
pcardunenitromaster, what is your error message?21:02
tehminkeh$ python contact.py21:02
tehminkehTraceback (most recent call last):21:02
tehminkeh  File "", line 3, in ?21:02
tehminkeh    import persistent21:02
tehminkehImportError: No module named persisten21:02
tehminkehthere is a t on the end of that output21:03
tehminkehi didnt copy it21:03
nitromastererror: TypeError: ('object.__new__(Contact) is not safe, use persistent.Persistent.__new__()', <function _reconstructor at 0xf7d4c570>, (<class ''>, <type 'object'>, None))21:03
kjcolePYTHONPATH ?21:03
Makorihii just say from persistent import Persistent21:03
pcardunenitromaster, hmm, hang around after class and we'll see what we can do21:03
pcardunenext week we will be doing iteration 321:04
mattva01sounds good21:04
mattva01back to World of Warcraft for me :)21:04
eldafarwow sucks21:04
Makorihipcardune: thanks for your time21:04
eldafarit's the bane of all mmo's21:04
pcardunethanks for coming and I hope you all learned a lot21:04
mlinnellpcardune: thanks21:04
kjcoleOff to "Taste of India" for me. ;-)21:05
pcarduneI'll see you next week21:05
kjcoleThanks Paul21:05
pcardunefeel free to hang around if you have questions21:05
*** tehminkeh has quit IRC21:05
*** Mounika has quit IRC21:05
*** mgarlapa has quit IRC21:05
kjcoleIn that case, I'll put off lunch and hang for a bit.21:05
*** Preetam has left #schooltool21:05
nitromasterso do you know why my zope intance didn't work?21:06
*** mattva01 is now known as mattva01|WoW21:06
Makorihihow does you import statement look like?21:07
pcardunenitromaster, send me the code you have for contact.py21:07
nitromasteri did21:07
pcarduneare you registered on freenode?  if not you can't send private messages21:08
nitromasterimport zope.interface21:08
nitromasterimport persistent21:08
nitromasterimport interfaces21:08
nitromasterclass Contact(persistent.Persistent):21:08
nitromaster    """Implementation of IContact"""21:08
nitromaster    zope.interface.implements(interfaces.IContact)21:08
nitromaster    lastName = u''21:08
nitromasteri guess i'll register21:08
pcarduneok, the only thing I can think of is that all the instances of contact are not deleted21:09
pcardunewhat is the url to your web server?21:09
nitromasterbut its down21:09
nitromastersince zope can't start...21:09
nitromastershould i take out persistent, and start it?21:10
pcardunenitromaster, yes21:10
*** mattva01|WoW has quit IRC21:11
nitromasterok, its up21:11
pcardunewhat is hello_test21:11
nitromasteri just was testing it out two days ago21:12
pcardunewell, the last thing I can suggest is that you delete the file in zope3/var/Data.fs21:12
nitromastereverything there is useless21:12
pcardunethat will delete everything in the database21:12
nitromasternow restart?21:12
nitromastershould i add persistent now?21:13
nitromasternice, it works!21:15
kjcoleOK, now me.21:16
kjcoleI gather that some people were seeing this Object view (or whatever it was)...21:16
kjcoleObject Introspector...  That was my first issue of the class, I think.21:17
Lumieremine too21:18
pcardunewhat was the issue?21:18
Lumierewe get a registration page21:18
Lumiereinstead of the Introspector21:18
kjcoleThat we're not seeing it. We get a registration page.21:18
*** nitromaster has quit IRC21:19
pcardunewell, there are a lot of different reasons why that might happen21:19
pcardunereasons that I myself haven't looked into at all21:19
pcardunemostly, it isn't really important at all as we will eventually be overridding all of that stuff in the future21:19
pcarduneat least, that is why I have never really looked into it much21:20
kjcoleIt 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 #schooltool21:21
*** Makorihi has quit IRC21:21
AVN`is today the class, or did I miss it?21:21
kjcoleWas the class.21:21
pcarduneit ended about 20 minutes ago21:21
pcardunebut you can read the logs21:21
kjcoleNext 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 class21:22
Lumierejust ask here21:23
Lumierecando-help was just to pull it outta the chat21:23
pcarduneAVN`, that's ok, the official lesson write up will be available in the next few days21:23
kjcoleclicking the link off of my index page leads me to21:23
pcardunejust make sure you follow it and understand everything21:23
pcardunekjcole, yeah, we specified the url for the edit page over simply21:23
pcarduneit should really be specified dynamically using tals21:24
kjcole"The page that you are trying to access is not available"21:24
pcarduneas in tal:attributes="href string:${context/@@absoluteURL}/edit.html"21:24
kjcoleOK, 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
pcardunewe didn't do that last tal bit because I didn't want to explain string: and @@absoluteURL just yet21:25
t3h_sood*does the happy dance* finally up to date. Thanks!21:28
kjcoleOK, 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 #schooltool21:29
pcardunei'm going to be leaving too21:29
t3h_soodI biddeth thee good farewell21:30
pcardunebye all21:30
*** pcardune has left #schooltool21:31
*** nitromaster has left #schooltool21:31
t3h_sood<_< bye peoples21:32
*** t3h_sood has left #schooltool21:32
*** kjcole has quit IRC21:33
*** aelkner has quit IRC21:33
*** bnguyen has quit IRC21:42
*** jinty has quit IRC21:43
*** mlinnell has quit IRC21:43
AVN`does indentation matter in zope?22:05
AVN`is there an easy scheme?22:07
eldafarfor what type of file?22:07, zcml, or .pt?22:07
eldafarusually, it's 2 spaces for sub tabs22:09
eldafaror that's the convention we use22:09
AVN`How do I access the ZMI for my zope instance?22:19
eldafardid you start it?22:19
AVN`I got some errors though22:20
AVN`but it says it started22:20
AVN`UserWarning: You did not specify an i18n translation domain for the 'title' field in /home/cbeacham/lib/python/zcontact/configure.zcml22:20
eldafarwhich should be shown to you when you start the instance22:21
eldafarthe port number that is22:21
AVN`I get this error in my browser22:21
AVN`UserWarning: You did not specify an i18n translation domain for the 'title' field in /home/cbeacham/lib/python/zcontact/configure.zcml22:21
AVN`The address type is unknown or unsupported22:22
eldafar works fine for me22:22
AVN`I see that22:23
AVN`I can see you accessing it22:23
AVN`maybe it doesn't work with opera?22:23
AVN`I guess I needed http22:23
eldafarno problem22:28
*** AVN` has quit IRC22:45
*** AVN` has joined #schooltool22:47
*** AVN` has quit IRC22:51
*** whaddon has joined #schooltool22:54
eldafarwhaddon: hey22:56
whaddonHi Eldar22:57
eldafarok, login to bonnieb22:58
whaddonI actually never got an account on bonnieb22:59
eldafarand screen -x22:59
eldafarno, log in as me22:59
eldafarI got scolded by Paul for re-adding quiz module :P23:01
*** AVN` has joined #schooltool23:04
AVN`eldafar, I can't see what the pt file is supposed to do23:05
AVN`I can't see the effect23:05
AVN`maybe its not working23:05
eldafarwhich .pt file?23:05
AVN`the first one we made during the lesson23:05
eldafarhold on23:06
AVN`, i think23:06
eldafari forgot its name23:06
eldafaroh ok23:06
eldafarPM me the contents of your viewcontent.pt23:06
eldafarwhat does your look like?23:07
AVN`I pmed it to you23: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
eldafarok, is there a problem with it?23:10
eldafarif you configured it properly, then when you access the contact object23:11 should be invoked23:11
AVN`how do I access it?23:11
AVN`he said to click preview23:11
eldafaryes, or you can just go directly to the object through its url23:12
AVN`but that just shows the screen you get before you login to the ZMI23:12
AVN`oh, it says a system error occured23:12
eldafarwhat's the traceback in your shell?23:12
AVN`its very long23:13
eldafarthe last 3-4 lines usually suffice23:14
AVN`  File "/usr/local/src/Zope3/src/zope/tales/", line 217, in __call__23:15
AVN`    return self._eval(econtext)23:15
AVN`  File "/usr/local/src/Zope3/src/zope/tales/", line 194, in _eval23:15
AVN`    ob = self._subexprs[-1](econtext)23:15
AVN`  File "/usr/local/src/Zope3/src/zope/tales/", line 118, in _eval23:15
AVN`    ob = vars[base]23:15
eldafarsorry, didn't notice it earlier23:17
eldafar="content/lastName" should be ="context/lastName"23:18
eldafardoes it work now, you don't have to restart zope when you edit .pt files23:22
AVN`I don't have to restart zope?23:25
eldafaronly when you change .py and .zcml files you restart zope23:26
eldafarwhen you change resources or page templates, you don't have to23:27
eldafarresources are things like .css files or images23:27
AVN`system error again23:28
AVN`  File "/usr/local/src/Zope3/src/zope/app/pagetemplate/", line 44, in __call__23:29
AVN`    return self.index(*args, **kw)23:29
AVN`  File "/usr/local/src/Zope3/src/zope/app/pagetemplate/", 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/", line 51, in __call__23:29
AVN`    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),23:29
AVN`  File "/usr/local/src/Zope3/src/zope/pagetemplate/", line 109, in pt_render23:29
AVN`    raise PTRuntimeError(str(self._v_errors))23:29
AVN`   - Warning: Compilation failed23:29
AVN`   - Warning: zope.tal.taldefs.TALError: bad TAL attribute: u'context', at line 4, column 1623:29
eldafaroh, you mixed them up again23:29
eldafarit should be23:29
eldafar<b tal:content="context/lastName"> Last Name </b>23:30
eldafarnot <b tal:context ....?23:30
AVN`content then context23:30
AVN`   ob = self._traverser(ob, element, econtext)23:32
AVN`  File "/usr/local/src/Zope3/src/zope/app/pagetemplate/", line 68, in __call__23:32
AVN`    request=request)23:32
AVN`  File "/usr/local/src/Zope3/src/zope/traversing/", line 164, in traversePathElement23:32
AVN`    return traversable.traverse(nm, further_path)23:32
AVN`   - __traceback_info__: (< object at 0xf626e930>, 'lastName')23:32
AVN`  File "/usr/local/src/Zope3/src/zope/traversing/", line 52, in traverse23:32
AVN`    raise TraversalError(subject, name)23:32
AVN`   - __traceback_info__: (< object at 0xf626e930>, 'lastName', [])23:32
eldafardoes your Contact object have a lastName attribute?23:33
eldafartry to match your code against the code on the website23:33
AVN`its lastname23:35
AVN`not lastName23:35
AVN`do I have to restart zope now?23:35
eldafarif you only changed .pt no23:36
eldafarif you changed something else, yes23:36
AVN`ok yes then23:36
eldafarany progress?23:38
AVN`will ctrl c quit zope?23:39
eldafaryes, it will stop it23:40
AVN`I see it23:41
AVN`doesn't say lewis though23:41
AVN`says Last Name23:41
eldafarare you sure you set lastName to lewis?23:45
eldafardid you make a mistake in your class when writing it?23:45
eldafarand named the variable lastname?23:45
AVN`I think its not supposed to say anything there yet23:47
eldafaryeh, cuz you don't have anything23:54
eldafarset for last name23:54
eldafarmove on to the edit part23:54

Generated by 2.15.1 by Marius Gedminas - find it at!