*** didymo has joined #schooltool | 00:20 | |
*** nitromaster has joined #schooltool | 00:32 | |
*** nitromaster has quit IRC | 01:16 | |
*** alga has quit IRC | 01:53 | |
*** jamesh has quit IRC | 02:22 | |
*** didymo has quit IRC | 02:37 | |
*** didymo has joined #schooltool | 02:39 | |
*** alga has joined #SchoolTool | 05:08 | |
DeathOmen | Lumiere: Are you available? | 05:28 |
---|---|---|
*** th1a has quit IRC | 06:38 | |
*** Ninno has quit IRC | 06:47 | |
*** alga has quit IRC | 07:30 | |
*** didymo has quit IRC | 13:34 | |
*** ignas has joined #schooltool | 13:57 | |
*** cpcarey11 has joined #schooltool | 16:37 | |
cpcarey11 | just making sure IRC works | 16:38 |
*** cpcarey11 has quit IRC | 16:39 | |
*** alga has joined #SchoolTool | 16:51 | |
*** nitromaster has joined #schooltool | 17:26 | |
*** kjcole has joined #schooltool | 17:31 | |
*** cpcarey11 has joined #schooltool | 17:35 | |
*** bnguyen has joined #schooltool | 17:37 | |
*** bnguyen has left #schooltool | 17:41 | |
DeathOmen | kjcole: Are you there? | 17:52 |
kjcole | I am | 17:52 |
DeathOmen | ok | 17:52 |
DeathOmen | I am an intern | 17:53 |
kjcole | Ah. | 17:53 |
DeathOmen | and I just wanted to ask you a question or two | 17:53 |
DeathOmen | I assume you have been following along in the lessons, am I right? | 17:54 |
kjcole | You may find out I'm more ignorant than you think. Especially regarding Zope. But give it a go. | 17:54 |
kjcole | Been trying to. | 17:54 |
DeathOmen | ok | 17:54 |
DeathOmen | well then for starters, is your Zope instance running the way you want it to? | 17:54 |
kjcole | Well, it "runs" but not quite as intended. | 17:55 |
DeathOmen | My main question is, when you are at the "index.html" | 17:55 |
kjcole | I mean, last week there were several moments where a few people expressed that things weren't running as Paul described, but then he said that those differences weren't important. | 17:56 |
DeathOmen | yeah | 17:56 |
DeathOmen | I have one difference | 17:56 |
DeathOmen | and I cannot find a place where it was addressed | 17:56 |
kjcole | jelkner: Joining us or just visiting? | 17:56 |
*** jelkner has joined #schooltool | 17:56 | |
DeathOmen | so I was wondering if you had the same issue | 17:56 |
DeathOmen | jelkner: Hello Mr. Elkner, it's Willi | 17:57 |
kjcole | Your question is when I'm at "index.html"... what? | 17:57 |
jelkner | DeathOmen: good morning | 17:57 |
DeathOmen | When you click on your "Contact" | 17:57 |
DeathOmen | And proceed to click on the "Edit" link | 17:58 |
DeathOmen | Does it point you in the right direction | 17:58 |
jelkner | ignas: i never heard the final word, are you coming to PyCon? | 17:58 |
ignas | jelkner: as i have got a visa - i think i am | 17:58 |
kjcole | Nope. But I'm hoping... in the next hour... to start from scratch and see if I can do it with the newer write-up of the lesson, rather than last week's IRC log. | 17:59 |
DeathOmen | In my case, I am directed to something that looks like this: http://maddog.yhspatriot.net:[port]/edit.html | 18:00 |
DeathOmen | Where I should be directed to: http://maddog.yhspatriot.net:[port]/Contact/edit.html | 18:01 |
DeathOmen | Ok, thanks for trying | 18:01 |
DeathOmen | It appears to be a simple fix, but I wouldn't know | 18:01 |
DeathOmen | jelkner: Did you see my Wiki edit!? | 18:02 |
jelkner | ignas: great! i'm looking forward to meeting you there! | 18:04 |
*** jelkner has quit IRC | 18:04 | |
*** DeathOmen has quit IRC | 18:04 | |
*** Fujitsu has quit IRC | 18:04 | |
*** Aim2 has quit IRC | 18:04 | |
kjcole | No can help. | 18:04 |
kjcole | I'm gonna disappear til showtime... | 18:07 |
*** kjcole has quit IRC | 18:07 | |
*** DeathOmen has joined #schooltool | 18:08 | |
*** DeathOmen has left #schooltool | 18:08 | |
*** wjohnsto has joined #schooltool | 18:09 | |
*** wjohnsto has quit IRC | 18:11 | |
*** wjohnsto has joined #schooltool | 18:11 | |
*** jelkner has joined #schooltool | 18:15 | |
*** Fujitsu has joined #schooltool | 18:15 | |
*** DeathOmen has joined #schooltool | 18:17 | |
*** Aim2 has joined #schooltool | 18:17 | |
*** tehminkeh has joined #schooltool | 18:19 | |
*** DeathOmen has quit IRC | 18:24 | |
*** AVN` has joined #schooltool | 18:35 | |
AVN` | woo! remembered this time | 18:36 |
jelkner | wjohnsto: I've made all the changes to the calendar and wiki | 18:39 |
*** mattva01 has joined #schooltool | 18:46 | |
wjohnsto | ok thanks | 18:48 |
*** bnguyen has joined #schooltool | 18:50 | |
*** alga has quit IRC | 18:50 | |
*** pcardune has joined #schooltool | 18:50 | |
*** mlinnell has joined #schooltool | 18:51 | |
jelkner | pcardune: morning, teach! | 18:52 |
wjohnsto | Let's see if I can keep up this time | 18:52 |
pcardune | jelkner, hello | 18:53 |
*** t3h_sood has joined #schooltool | 18:54 | |
*** t3h_sood is now known as masood | 18:54 | |
*** aelkner has joined #schooltool | 18:54 | |
jelkner | pcardune: I've put up the summer schedule (see https://svn.schooltool.org/trac/cando) | 18:55 |
jelkner | i can put you down for all 3 sprints, yes? | 18:55 |
*** Mounika has joined #schooltool | 18:55 | |
*** Mounika is now known as mgarlapa | 18:55 | |
pcardune | jelkner, yes | 18:56 |
*** kjcole has joined #schooltool | 18:59 | |
pcardune | ok, my clock says 9am PST so let's start | 19:00 |
pcardune | is anyone not here? | 19:00 |
pcardune | ok good | 19:00 |
masood | mebbe jama? | 19:00 |
wjohnsto | yeah | 19:00 |
* kjcole is Kevin Cole | 19:00 | |
* jelkner is Jeff Elkner | 19:00 | |
nitromaster | is everyone supposed to chime in? | 19:01 |
* wjohnsto is William Johnston | 19:01 | |
* AVN` is Chris Beacha, | 19:01 | |
pcardune | welcome to the third week of our Zope3 class. First we will briefly go over what we covered last time, and then get into some work. | 19:01 |
AVN` | Beacham | 19:01 |
jelkner | yes | 19:01 |
pcardune | \me is the teacher | 19:02 |
* pcardune is the teacher | 19:02 | |
* nitromaster is Andrew Rodriguez | 19:02 | |
pcardune | (woops) | 19:02 |
* cpcarey11 is Chris Carey | 19:02 | |
pcardune | Last week we made our first page templates and a browser view class. This allowed us to display information about a contact and have the user input information about a contact with html forms. We also made our object persistent and learned how to register pages in ZCML. | 19:02 |
wjohnsto | (we'll let that go, this time) | 19:02 |
pcardune | Today we will continue working on how information is displayed to and inputted by the user. Our major goal for this application is to have a well functioning and slender address book. But at the moment, all we can enter in about a person is their last name (a bit to slender of an address book to be useful). We want to continue by adding more peices of information to store about a contact - specifically their first name, phone number, email address, a | 19:02 |
pcardune | nd street address. | 19:02 |
pcardune | Can anyone tell me what the first step is going to be? (hopefully only one person will answer) | 19:03 |
masood | modify the zcontact class? | 19:03 |
wjohnsto | a new pt file? | 19:03 |
pcardune | close... but that isn't first | 19:04 |
pcardune | You might look back to where we first started. What was the first thing we wrote (besides the __init__.py file)? | 19:04 |
*** Preetam has joined #schooltool | 19:04 | |
cpcarey11 | the interface? | 19:04 |
nitromaster | the interface | 19:04 |
wjohnsto | interfaces | 19:04 |
pcardune | exactly | 19:04 |
pcardune | When you modify the description of an object (not necessarily the implementation) then you have to first change the interface - which describes an object. So the first thing you should do is open up the interfaces.py file for editing. | 19:04 |
wjohnsto | I see! | 19:04 |
pcardune | Now your first instinct is probably going to be to create more Attributes. But in fact we will actually be creating what is called a schema. Schemas are a lot like interfaces except that instead of creating a contract for a class implementation, schemas form a contract for each individual attribute in a class. | 19:05 |
*** ignas has quit IRC | 19:06 | |
pcardune | Let's just write the schema, and I will explain how it works once we have something to look at. The first thing to do is to add a line at the top of the file that says "import zope.schema" | 19:06 |
pcardune | Next, modify the lastName attribute to look like this: | 19:06 |
pcardune | lastName = zope.schema.TextLine( | 19:06 |
pcardune | title=u"Last Name", | 19:06 |
pcardune | description=u"A person's last name.", | 19:06 |
pcardune | required=True) | 19:06 |
*** ignas has joined #schooltool | 19:07 | |
pcardune | let me know if I'm going to fast btw | 19:07 |
wjohnsto | I'm good so far | 19:08 |
pcardune | With that code in place, the IContact interface is now also a schema. Schemas are built right into interface definitions because they essentially extend an interface. | 19:08 |
pcardune | It is reasonable to think the difference between interfaces and schemas is pretty arbitrary and only a matter of nomenclature. | 19:08 |
pcardune | For now, it's fine to think of schemas and interfaces as the same thing because they are so intertwined. Just note that they are in fact somewhat different. | 19:09 |
wjohnsto | do we still need "import zope.interface" at the top of our program? | 19:09 |
pcardune | Stephan Richter writes in his Zope 3 book, The methods of an interface describe the functionality of a component, while the schema's fields represent the state." | 19:09 |
pcardune | wjohnsto, yes, keep the zope.interface part at the top | 19:09 |
pcardune | remember, our IContact interface is still inheriting from the zope.interface.Interface class | 19:09 |
pcardune | schemas don't exist outside of interfaces. that is, you cant have a schema that isn't also an interface | 19:10 |
pcardune | Looking at the code, we see that instead of creating an Attribute object as we had before, we have a TextLine field. | 19:10 |
pcardune | When we refer to attributes that are set with schemas, we call them schema fields. | 19:11 |
pcardune | Schemas allow us to specify what kind of data should be stored in a particular variable, whether it is string data, numerical data, a date, a url, a list of things, etc. For a longer list of schema fields, look at Chapter 8.3 of the Zope 3 Book ( http://wiki.zope.org/zope3/schema.html). | 19:11 |
masood | are we having Schema be inherited like Interface? | 19:11 |
pcardune | no | 19:11 |
masood | so it's a kind of object type stored in the interface? | 19:12 |
pcardune | the only thing that makes something a schema, is to have attributes in the interface definition that are set with schema fields (i.e. zope.schema.WhatEver()) | 19:12 |
pcardune | masood, right | 19:12 |
AVN` | so a schema is kind of like a variable that stores other variables? | 19:13 |
pcardune | even though python is a non-typed language, we still want our application to function correctly | 19:13 |
pcardune | sort of, except that the storage is totally transparent to python | 19:13 |
pcardune | it really just defines a type of data | 19:13 |
pcardune | then then implementation is free to validate the data it is storing with what the schema requires | 19:14 |
pcardune | kind of like type checking | 19:14 |
masood | sounds like having a format for a typeless buffer though... | 19:14 |
pcardune | for example, if we had a field like zope.schema.Float, and the user entered "hi how are you", then zope would spit back an error at the user | 19:15 |
pcardune | Schemas also allow us to specify documentation in the form of a title and a description. What you put in title and description can end up in the user interface as we will see later in the lesson. | 19:16 |
pcardune | Basically, schema fields and better than interface Attributes when it comes to data the user will interact with, because we can provide more specific documentation (in the form of a title and description) and more information about the attribute | 19:16 |
pcardune | Finally, there is the required parameter which specifies whether or not the attribute must be filled in with data - the alternative being to leave it empty (None) | 19:17 |
pcardune | depending on what kind of schema field you use, there are different key word arguments for their constructors, but we won't be encountering that right now. | 19:18 |
pcardune | So now that we understand how that works, lets go ahead and add more schema fields for each of our new attributes: firstName, phone, email and address. These will all be using the TextLine schema field. The only required attribute should be lastName. | 19:18 |
wjohnsto | I'm psyched | 19:19 |
pcardune | You might think that the address should be another type in itself, with specific definitions for "Street", "zip code", etc. but we'll get to that later | 19:19 |
pcardune | for now we will just assume that the user will format the address sanely | 19:20 |
pcardune | Your interfaces.py file should look like this: (get ready for a lot of stuff) | 19:20 |
pcardune | import zope.interface | 19:20 |
pcardune | import zope.schema | 19:20 |
pcardune | class IContact(zope.interface.Interface): | 19:20 |
pcardune | """The interface for a contact.""" | 19:20 |
pcardune | lastName = zope.schema.TextLine( | 19:20 |
pcardune | title=u"Last Name", | 19:20 |
ignas | pcardune: lisppaste! | 19:20 |
pcardune | description=u"A contact's last name.", | 19:20 |
pcardune | required=True) | 19:20 |
pcardune | firstName = zope.schema.TextLine( | 19:20 |
pcardune | title=u"First Name", | 19:20 |
pcardune | description=u"A contact's first name.", | 19:20 |
pcardune | required=False) | 19:20 |
pcardune | phone = zope.schema.TextLine( | 19:20 |
pcardune | title=u"Phone", | 19:20 |
pcardune | description=u"A contact's phone number.", | 19:20 |
pcardune | required=False) | 19:21 |
pcardune | email = zope.schema.TextLine( | 19:21 |
pcardune | title=u"Email", | 19:21 |
pcardune | description=u"A contact's email address.", | 19:21 |
pcardune | required=False) | 19:21 |
pcardune | address = zope.schema.TextLine( | 19:21 |
pcardune | title=u"Address", | 19:21 |
pcardune | description=u"A contact's address.", | 19:21 |
pcardune | required=False) | 19:21 |
pcardune | ignas, sorry | 19:21 |
pcardune | \msg lisppaste5 help | 19:21 |
ignas | lisppaste5: url | 19:21 |
lisppaste5 | To use the lisppaste bot, visit http://paste.lisp.org/new/schooltool and enter your paste. | 19:21 |
ignas | gives you python syntax highlighting by default for #schooltool | 19:21 |
nitromaster | couldn't we make a something that could check email, telephone etc, instead of just TextLine ? | 19:21 |
ignas | nitromaster: you can add cusotm validator functions i think | 19:22 |
ignas | if not for fields, then for the whole schema for sure | 19:22 |
lisppaste5 | pcardune pasted "interfaces.py" at http://paste.lisp.org/display/36321 | 19:23 |
pcardune | nitromaster, if you really wanted to, you could validate phone numbers against some government database or something (to make sure the area code actually exists, etc.) | 19:24 |
pcardune | but we wont be doing that... | 19:24 |
nitromaster | no, I mean that emails must have a '@', and a '.' etc | 19:24 |
pcardune | nitromaster, yeah, you could do that too of course | 19:24 |
pcardune | Now that we have modified our interface and extended it into a schema, we need to change the implementation to match the schema. So open up the contact.py file and add the new attributes. | 19:25 |
lisppaste5 | pcardune pasted "contact.py" at http://paste.lisp.org/display/36322 | 19:25 |
tehminkeh | somebody wanna turn of lisppaste5? | 19:26 |
tehminkeh | hes pissing me off | 19:26 |
tehminkeh | oh wait | 19:26 |
tehminkeh | i read what hes typing | 19:26 |
tehminkeh | never mind | 19:26 |
tehminkeh | i thought he was a bot telling pcardune to paste his stuff on a site | 19:27 |
tehminkeh | not a bot saying that he did | 19:27 |
tehminkeh | ignore this wall of text | 19:27 |
masood | <_< | 19:27 |
pcardune | the Contact class is the place where we would set up validation for the schema fields. | 19:27 |
pcardune | But since we are only using textlines, we are pretty open to what goes in the variables | 19:27 |
pcardune | so we won't be setting up validation at this time | 19:27 |
pcardune | I don't believe there is any validation of user input with textline schema fields by default | 19:28 |
ignas | nitromaster: you can pass a constraint keyword parameter to the constructor of a field, constraint being a python function that returns True if the value is valid | 19:28 |
nitromaster | oh ok, thanks ignas | 19:28 |
ignas | pcardune: there is - TextLines can't contain newlines | 19:28 |
pcardune | oh... | 19:29 |
pcardune | moving on now, can anyone tell me what we should be doing next? | 19:29 |
AVN` | modifying the pt? | 19:30 |
pcardune | AVN`, which one? | 19:30 |
AVN` | uh, the one that allows you to change the variables? | 19:30 |
masood | editcontact | 19:30 |
masood | ? | 19:30 |
wjohnsto | we could try and edit stuff in the ZMI | 19:31 |
wjohnsto | and see if it works | 19:31 |
pcardune | well, let's start with viewcontact.pt | 19:31 |
pcardune | we are going to do something special with editcontact.pt | 19:31 |
lisppaste5 | pcardune pasted "viewcontact.pt" at http://paste.lisp.org/display/36323 | 19:32 |
nitromaster | what's the difference between tal:content and tal:replace? | 19:34 |
lisppaste5 | pcardune annotated #36323 with "viewcontact.pt" at http://paste.lisp.org/display/36323#1 | 19:34 |
pcardune | I made a mistake, the file should look like this (the only different is the body tag) | 19:34 |
pcardune | (you don't need to change the body tag from what we had before) | 19:34 |
pcardune | tal:replace will replace the entire tag, rather than just what between the <tags></tags> | 19:35 |
pcardune | Pay particularly close attention to the tal:content attribute for displaying the first and last name. | 19:36 |
pcardune | When we start with string:, that tells the page template parser that what follows is not a path expression. Rather it is a string expression. | 19:36 |
pcardune | String expressions return plain strings. If we want to include dynamic variables in the string that the expression returns, then we have to wrap them up in ${}. | 19:36 |
pcardune | In python, this expression might look like "%s, %s" % (context.lastName, context.firstName). Instead of using %s, we just put the variable right inside the string expression. | 19:37 |
pcardune | alternatively, we could have done two separate tags with regular path expressions, but it makes more sense to put the first and last name in just one tag (as you would do if you were writing straight html instead of page templates) | 19:38 |
pcardune | So that should be it for the viewcontact.pt file | 19:38 |
wjohnsto | editcontact.pt now? | 19:39 |
pcardune | yep | 19:39 |
pcardune | except we aren't actually going to change it at all | 19:39 |
wjohnsto | that's what I like to hear | 19:39 |
pcardune | you may remember that to get the from in editcontact.pt, we had to create a browser view class that handled the data input | 19:39 |
pcardune | and that can get really cumbersome when you start having a lot of data | 19:39 |
pcardune | (it was fine for just one variable) | 19:39 |
pcardune | To combat this problem, Zope 3 is capable of auto generating forms, and even browser views that handle the form input! | 19:40 |
*** joikle has joined #schooltool | 19:40 | |
pcardune | In fact, we don't even need to write a page template at all. The only thing we need to do is change some zcml registration. That said, open up the configure.zcml file. | 19:41 |
pcardune | Scroll down to place where we registered the edit.html page for editing a contact. I want you to replace that entire tag with a new one that looks like this: | 19:42 |
pcardune | <browser:editform | 19:42 |
pcardune | label="Edit Contact" | 19:42 |
pcardune | for="zcontact.interfaces.IContact" | 19:42 |
pcardune | name="edit.html" | 19:42 |
pcardune | permission="zope.ManageContent" | 19:42 |
pcardune | schema="zcontact.interfaces.IContact" | 19:42 |
pcardune | /> | 19:42 |
pcardune | You will notice in the code that we kept the the attributes name, for and permission the same. We got rid of the template file becase we are no longer going to need it, and we added a label and a schema. The label attribute just tells Zope what to display at the top of the form (so that the user knows what they are looking at). The schema attribute obviously tells zope which schema to generate the form from. | 19:43 |
pcardune | Zope will look at the attributes in the scema, look at what we put for title and description, and look at the type of schema field it is (text input, date input, etc) and display the appropriate widget in html (input box, radio buttons, drop down list, etc.) | 19:44 |
Preetam | nice | 19:44 |
pcardune | As I said before, the auto generated forms also automatically handle form input. That means that all the data the user enters will be automatically stored into the right object. | 19:44 |
pcardune | On top of that, before storing any data, it will verify that the input is of the correct type (a valid date, a number vs. characters, a url, etc.). If the input is not correct, it automatically spits an error back to the user, asking them to fill in the correct information. | 19:45 |
pcardune | it also does casting of data types | 19:45 |
pcardune | all data passed to a zope server through http POSTs is in string form | 19:46 |
pcardune | numbers are passed like "3.14" | 19:46 |
pcardune | the form will automatically cast that into a float for storage into the object (assuming the schema field is a Float) | 19:46 |
pcardune | At this point, you should restart your zope server and try out that edit form! | 19:47 |
tehminkeh | i got an error | 19:47 |
tehminkeh | for runzope | 19:47 |
pcardune | tehminkeh, what was the last part of it? | 19:47 |
tehminkeh | well | 19:47 |
tehminkeh | i found what seems to be broken | 19:47 |
tehminkeh | No module named schema | 19:48 |
tehminkeh | when i try to import interfaces | 19:48 |
tehminkeh | but the error was "Error when calling the metaclass bases" | 19:48 |
wjohnsto | !!!You can all go to #cando-help if you have general questions so we don't take up so much space here!!! | 19:49 |
pcardune | are you sure your file looks like this: http://paste.lisp.org/display/36321 | 19:49 |
pcardune | so it looks like most people were able to restart their zope servers just fine | 19:50 |
masood | one question... does zope support javascript output? | 19:50 |
pcardune | does anyone see something different about the edit page? | 19:50 |
masood | just a random question | 19:50 |
pcardune | javascript is client side... and zope is server side... | 19:51 |
pcardune | so they are two very separate things | 19:51 |
wjohnsto | mine works completely | 19:51 |
wjohnsto | http://maddog.yhspatriot.net:8120/Contact | 19:51 |
pcardune | I haven't seen any stuff in zope for generating javascript like you might have seen in google's java libraries | 19:52 |
pcardune | but there are some javascript based form elements in zope (like the date widget) | 19:52 |
*** mgarlapa has quit IRC | 19:53 | |
*** Mounika has joined #schooltool | 19:54 | |
masood | I can't seem to get it to edit my contact info | 19:54 |
aelkner | pcarduner: when I add a z contact, I get "This object isn't yet registered." Am I doing something wrong? | 19:55 |
pcardune | aelkner, see me in cando-help | 19:56 |
tehminkeh | hey | 20:00 |
tehminkeh | i deleted | 20:00 |
tehminkeh | Data.fs | 20:00 |
tehminkeh | and im stillgetting | 20:00 |
tehminkeh | zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/sdrodge/zope3/etc/site.zcml", line 7.2-7.55 | 20:01 |
tehminkeh | ZopeXMLConfigurationError: File "/home/sdrodge/zope3/etc/package-includes/zcontact-configure.zcml", line 1.0-1.30 | 20:01 |
tehminkeh | ZopeXMLConfigurationError: File "/home/sdrodge/zope3/lib/python/zcontact/configure.zcml", line 4.4 | 20:01 |
tehminkeh | TypeError: Error when calling the metaclass bases | 20:01 |
tehminkeh | Cannot create a consistent method resolution | 20:01 |
tehminkeh | order (MRO) for bases object, Persistent | 20:01 |
jelkner | pcardune: it is 1 pm, can i get a word into everyone before they leave? | 20:01 |
pcardune | jelkner, we usually do two hours no? | 20:01 |
jelkner | oh, wow, i didn't know that | 20:02 |
pcardune | jelkner, that is what we did last year... | 20:02 |
* wjohnsto slaps jelkner saying "Pay Attention!!!" | 20:02 | |
jelkner | well let me not get in your way then... | 20:02 |
jelkner | ;-) | 20:02 |
pcardune | ok, I think most people have any problems mostly under control now | 20:04 |
pcardune | if not, see me in cando-help | 20:04 |
pcardune | we are going to continue | 20:04 |
jelkner | pcardune: i have parental duties that will take me away... can i have a word during the 1/2 time break then? | 20:04 |
pcardune | jelkner, sure, just message me | 20:05 |
*** joikle has quit IRC | 20:05 | |
*** joikle_ has joined #schooltool | 20:05 | |
pcardune | or talk to the class if that is who you want to | 20:05 |
jelkner | real quick, i've sent email to the list | 20:06 |
jelkner | all interns need an account on the cando wiki | 20:06 |
jelkner | we need folks to let us know as soon as possible which of the summer sprints they would like to attend | 20:06 |
jelkner | so we can begin planning and budgeting for them | 20:07 |
wjohnsto | I'm signed up, I just need to consult my parents | 20:07 |
jelkner | anyone who wants to can go to the dc sprint | 20:07 |
jelkner | we will be taking a van to atlanta and new hampshire | 20:07 |
jelkner | so space will be an issue | 20:07 |
wjohnsto | I edited the Summer Interns wiki yesterday, along with bnguyen | 20:07 |
jelkner | we may need to do some balancing | 20:08 |
jelkner | wjohnsto: yes, and you did a great job! thanks! | 20:08 |
jelkner | so the earlier you let us know, the better | 20:08 |
jelkner | thanks, teach, sorry for the interruption | 20:09 |
pcardune | ok, now we are going to continue | 20:09 |
pcardune | if you managed to get to the edit.html screen, you will have noticed that it is built right into the ZMI | 20:09 |
*** jelkner has quit IRC | 20:09 | |
wjohnsto | PYTHONPATH=/usr/local/src/Zope3/src | 20:09 |
wjohnsto | export PYTHONPATH | 20:09 |
pcardune | The auto generated forms use whats called a page macro, which essentially sticks it into the ZMI. Or it might be better to say that the macro sticks the ZMI around the auto generated form. | 20:11 |
pcardune | It would be really cool if our entire contact system were built right into the ZMI. This is one of the cool things about Zope. Since we are talking about a component architecture, we often want to build one component into another one. That is, we want out Z Contact application to work seemlessly with all the other components in Zope - especially when it comes to navigation. | 20:12 |
mattva01 | sadly, i have to go(i'll look at the logs later) | 20:12 |
masood | cya | 20:12 |
wjohnsto | c ya | 20:13 |
pcardune | Fortunately, adding the page macro to our application is almost trivial. We only have one page template now, the viewcontact.pt file. Open up that file for editing and change the top two lines, which include the html tag and the body tag, to: | 20:13 |
pcardune | <html metal:use-macro="context/@@standard_macros/view"> | 20:13 |
pcardune | <body metal:fill-slot="body"> | 20:13 |
wjohnsto | mattva01: if you need help, you can contact me | 20:13 |
*** mattva01 has left #schooltool | 20:13 | |
lisppaste5 | pcardune annotated #36323 with "viewcontact.pt (with macros)" at http://paste.lisp.org/display/36323#2 | 20:14 |
pcardune | Here we are using the metal namespace. Macros are a lot like page templates in that they define a general layout for something. The difference is that instead of filling in tags with data from a database, a page macro fills in slots with html generated from a page template. This way we can have page templates generate html for multiple parts of a page, and they can be glued together using the macro. For example, in the ZMI, one of the slots is the bo | 20:15 |
pcardune | dy, which is what you see in the main pane. The other slots include the tabs at the top, the navigation on the left, and the add menu on the left, among other things. | 20:15 |
pcardune | The metal:fill-slot attribute on the body tag tells the page tempalte rendering engine that we are going to take everything inside this body tag, and stick it into the body slot in the macro. The fact that the name of the tag and the name of the slot are the same is totally arbitrary. We could just have easily used a div instead of a body tag for the metal:fill-slot attribute | 20:16 |
pcardune | Now that you have changed the page template, go ahead and reload the page which displays the contact object. Remember, you do not have to restart your zope server if you only changed a page template. | 20:18 |
wjohnsto | Wow, cool graphics! | 20:21 |
masood | system error... to cando-help again... | 20:21 |
cpcarey11 | should viewcontact.py have a link to edit.html? | 20:24 |
pcardune | cpcarey11, if you want, but we are about to make that unnecessary | 20:25 |
masood | oo, classy looking | 20:25 |
cpcarey11 | ok | 20:25 |
pcardune | If you have explored around the ZMI a bit, you will have noticed that a lot of navigation is accessed through the tabs you see at the top of every page. Since we want out contact application to be built right into the ZMI, it would be handy if the navigation worked in the same way. | 20:25 |
pcardune | To add these tabs for the main display page and the edit page, we will have to edit the page configurations in the configure.zcml file. | 20:26 |
pcardune | add this line to the page tag attributes: menu="zmi_views" title="View" | 20:27 |
pcardune | and this line to the editform tag: menu="zmi_views" title="Edit Contact" | 20:27 |
lisppaste5 | pcardune pasted "configure.zcml" at http://paste.lisp.org/display/36325 | 20:28 |
masood | oo, that's the first thing i've seen today where the names actually make sense to their usage! (M) | 20:29 |
aelkner | Now it brings up the index.html when I click on the object! | 20:29 |
pcardune | yep | 20:30 |
ignas | pcardune: cando is still using zmi menus? | 20:30 |
tehminkeh | do we have to restart server after that one? | 20:30 |
pcardune | ignas, no, cando doesn't use zmi menus | 20:30 |
nitromaster | omg, that's beautiful | 20:30 |
pcardune | ignas, it uses schooltool_actions and viewlets | 20:30 |
pcardune | tehminkeh, yes, you have to restart the server for changes to zcml | 20:31 |
*** mgedmin has joined #schooltool | 20:31 | |
pcardune | so that is pretty cool. | 20:32 |
aelkner | it sure it. | 20:32 |
aelkner | is | 20:32 |
tehminkeh | wow | 20:33 |
pcardune | That is all I have planned for today's lesson, next week we'll do stuff with Containers | 20:33 |
tehminkeh | thats pretty sexay | 20:33 |
masood | tis' | 20:33 |
masood | so | 20:33 |
masood | it's tabby | 20:33 |
masood | like firefox | 20:33 |
masood | almost | 20:33 |
pcardune | so if anyone has any questions, or would like me to discuss anything a bit more in depth, please feel free to ask now and we can make the last half hour an open discussion | 20:33 |
aelkner | Are we going to wire the pages to have a button to bring you to the edit page so that you don't have to use the tabs? | 20:34 |
pcardune | aelkner, why would you not want to use the tabs? | 20:34 |
pcardune | the tabs are cool! | 20:34 |
AVN` | huh, I got 2 values for Name | 20:35 |
aelkner | Agreed. Only it would be nice tho eliminate the step of hitting the change button, then hitting the view tab. | 20:35 |
masood | tabs = (y) | 20:35 |
aelkner | Before hitting the change button got us back to viewing. | 20:35 |
aelkner | Not so now. | 20:35 |
tehminkeh | yeah | 20:35 |
tehminkeh | i noticed that | 20:36 |
pcardune | aelkner, that's true, and we can modify that behavior later | 20:36 |
pcardune | oh, another thing to do | 20:36 |
pcardune | delete the brower.py file (we don't need it anymore) | 20:36 |
pcardune | and delete the editcontact.pt file (we don't need that anymore either) | 20:36 |
pcardune | this process of deleting code is called "refactoring" | 20:37 |
wjohnsto | not just "deleting?" | 20:37 |
pcardune | it's called that too, refactoring just sounds more constructive | 20:37 |
wjohnsto | ok | 20:37 |
Preetam | lol | 20:38 |
AVN` | is it supposed to take 2 values for Name? | 20:38 |
aelkner | refactoring means changing, not just deleting. | 20:38 |
pcardune | AVN`, remember that we have a last name and a first name | 20:38 |
pcardune | and that they are separate fields | 20:39 |
*** Preetam has left #schooltool | 20:39 | |
AVN` | yeah, Name:Lewis, Ashley Last Name: Lewis | 20:39 |
*** cpcarey11 has quit IRC | 20:40 | |
AVN` | oh, | 20:40 |
AVN` | i see | 20:40 |
pcardune | any questions? aelkner? kjcole? | 20:41 |
kjcole | pcardune, I decided to work through my problems of last week, and basically have been ignoring, but privately logging, this week's lesson. So, I'm sure I have LOTS of questions. | 20:43 |
kjcole | pcardune, I just don't know what they are yet. ;-) | 20:43 |
kjcole | I do have a small one from last week though. Here or #cando-help? | 20:44 |
pcardune | either | 20:45 |
aelkner | pcarduner: we still on after class for a phone call? | 20:45 |
pcardune | btw, I encourage you all to play around with the code and see what other cool things you can make it do. just be sure to keep a clean copy that works for next week | 20:45 |
pcardune | aelkner, yep | 20:45 |
kjcole | OK. I hope it hasn't been covered while I was ignoring. I note that going to host:port/zcontact is different from going to host:port/zcontact/ with a trailing slash. | 20:46 |
kjcole | Both show me the index.html view contact, but for the one without the slash, the edit button takes me to the wrong place. | 20:46 |
kjcole | Any idea how to fix that? | 20:46 |
pcardune | yes | 20:47 |
pcardune | you need to modify the edit button to use @@absolute_url | 20:47 |
pcardune | the edit link would like like this: | 20:47 |
pcardune | <a tal:attributes="href string:${context/@@absolute_url}/edit.html">Edit</a> | 20:48 |
pcardune | this is how links between different pages for an object should usually be done | 20:48 |
pcardune | the context/@@absolute_url part grabs the exact url of the object (which has a trailing '/') | 20:48 |
pcardune | or sorry, does *not* have a trailing slash | 20:49 |
masood | when someone is browsing the internet, the directories that follow the domain... are they simply made into a string and passed to the domain for the domain to process or are the directories accessed like you were going through an ftp server (the entire url is a path)? | 20:50 |
*** Mounika has quit IRC | 20:50 | |
pcardune | masood, they are made into a string | 20:50 |
kjcole | Thanks. Did others have the trouble, and did I miss a previous question/answer on that? (Some of last week's issues like not seeing the Introspector have been resolved | 20:50 |
pcardune | the server then parses that string | 20:50 |
kjcole | since starting completely from scratch on my own machine.) | 20:50 |
pcardune | kjcole, we mentioned that really quickly last week, but not much in depth | 20:50 |
masood | so that explains why you don't need .html or something at the end... | 20:51 |
pcardune | masood, right | 20:51 |
kjcole | pcardune, well, since now things seem to be going approximately the way they should have gone last week, I think I'll be better able to catch up to today. | 20:51 |
nitromaster | kjcole: if you can't see the introspector, turn on developer mode in etc/zope.conf near the end of the file | 20:51 |
pcardune | if no one else has questions, you are all free to go | 20:52 |
masood | cya | 20:52 |
*** masood has left #schooltool | 20:53 | |
kjcole | nitromaster, Ah! That may have been the problem on maddog. On my local system, I'm using the Ubuntu zope3 package rather than building from scratch. It may use a different default skeleton. | 20:53 |
kjcole | S'long. | 20:53 |
nitromaster | pcardune: we can change how everything is made right, like schema's etc.. is that in a configuration file, or in the code? | 20:54 |
pcardune | nitromaster, what do you mean by "how everything is made"? | 20:54 |
nitromaster | like the tabs being blue, the form size etc | 20:55 |
nitromaster | like the artist aspects | 20:55 |
pcardune | yes you can change that | 20:55 |
pcardune | we may get to that later | 20:55 |
nitromaster | ok, coo | 20:55 |
nitromaster | l | 20:55 |
pcardune | it involves creating our own macros and skins | 20:55 |
nitromaster | and can we change like the tabs? | 20:55 |
nitromaster | because you need more than a skin for that | 20:56 |
pcardune | we can change everything about how it looks | 20:57 |
*** AVN` has left #schooltool | 20:57 | |
pcardune | not just the colors, but the layout | 20:57 |
pcardune | what tabs are displayed | 20:57 |
pcardune | how navigation works | 20:57 |
nitromaster | good | 20:57 |
*** mgedmin has quit IRC | 20:57 | |
pcardune | you can look at my site, http://www.carduner.net which is a zope application to see some of how you can change the way it looks | 20:58 |
pcardune | that is all done with modified skins and macros | 20:58 |
wjohnsto | if | 20:58 |
wjohnsto | wait | 20:58 |
wjohnsto | if we deleted browser | 20:59 |
nitromaster | cool | 20:59 |
wjohnsto | what do we put instead of zcontact.browser.ContactView | 20:59 |
wjohnsto | ? | 20:59 |
wjohnsto | in the page browser form | 20:59 |
pcardune | you mean in the editform tag in configure.zcml? | 21:00 |
pcardune | oh right, you just take that whole bit out | 21:01 |
wjohnsto | ok | 21:01 |
kjcole | Oh, one last (probably covered question): | 21:03 |
pcardune | yeah? | 21:03 |
kjcole | "You did not specify an i18n translation domain for the... configure.zcml" | 21:04 |
kjcole | What magic gets added to configure.zcml to make that go away? | 21:04 |
pcardune | the i18n translation domain isn't needed until we start doing internationalization | 21:05 |
aelkner | yeah, i get warnings about that from runzope. | 21:05 |
kjcole | I just figured there was a simple way to quiet it down, by specifying some default or a "don't warn me" thing in there. | 21:06 |
aelkner | shouldn't we have it set up with a default for now? | 21:06 |
aelkner | What would that look like? | 21:06 |
pcardune | you might just i18n_domain="zcontact" | 21:07 |
pcardune | it won't really do anything at this point | 21:08 |
pcardune | ok, well i'm going to go make some breakfast for myself, aelkner give me a call in 10 minutes | 21:09 |
aelkner | pcardune: I already tried and there was no reply. Do you have your phone on? | 21:10 |
*** bnguyen has quit IRC | 21:11 | |
kjcole | OK. Later then. Thanks again. (I'm going to get late lunch.) | 21:11 |
*** kjcole has quit IRC | 21:12 | |
*** tehminkeh has quit IRC | 21:15 | |
pcardune | aelkner, yes, i picked up but there was no one there... | 21:15 |
pcardune | aelkner, why don't I call you on skype | 21:15 |
*** mlinnell has quit IRC | 21:16 | |
aelkner | Ok. in two minutes. | 21:16 |
aelkner | pcardune: off the phone. call me when ready. | 21:22 |
*** pcardune has quit IRC | 21:35 | |
*** aelkner has quit IRC | 21:44 | |
*** pcardune has joined #schooltool | 22:02 | |
*** aelkner has joined #schooltool | 22:03 | |
*** Aiste has joined #schooltool | 22:24 | |
*** mgedmin has joined #schooltool | 22:43 | |
*** Aiste has quit IRC | 22:46 | |
*** wjohnsto has quit IRC | 22:47 | |
*** mgedmin has quit IRC | 22:55 | |
Fujitsu | Is there a write-up of the Zope classes anywhere, or just the logs? | 23:23 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!