*** didymo has quit IRC | 00:00 | |
*** jfroche_ has quit IRC | 01:36 | |
*** filip101 has joined #schooltool | 02:25 | |
*** filip101 has left #schooltool | 02:25 | |
*** wrobel has quit IRC | 03:22 | |
*** wjohnsto has quit IRC | 05:54 | |
*** wjohnsto has joined #schooltool | 05:54 | |
*** wjohnsto has quit IRC | 06:07 | |
*** wjohnsto has joined #schooltool | 06:08 | |
*** didymo has joined #schooltool | 08:07 | |
*** Fujitsu has quit IRC | 11:30 | |
*** Fujitsu has joined #schooltool | 11:31 | |
*** jinty has joined #schooltool | 12:53 | |
*** Fujitsu has quit IRC | 13:20 | |
*** Fujitsu has joined #schooltool | 13:28 | |
*** wrobel has joined #schooltool | 14:08 | |
*** pcardune has joined #schooltool | 16:32 | |
*** filip101 has joined #schooltool | 16:36 | |
wjohnsto | pcardune: Are you there? | 17:22 |
---|---|---|
pcardune | wjohnsto: yes | 17:23 |
wjohnsto | Do we use the rotterdam as our standard skin for the Zope3 class? | 17:36 |
wjohnsto | ** rotterdam skin | 17:36 |
*** jinty has quit IRC | 17:36 | |
*** mlinnell has joined #schooltool | 18:34 | |
*** filip101 has quit IRC | 18:35 | |
*** bnguyen has joined #schooltool | 18:39 | |
*** tehminkeh has joined #schooltool | 18:48 | |
*** filip101 has joined #schooltool | 18:50 | |
*** jelkner has joined #schooltool | 18:52 | |
*** KP202 has joined #schooltool | 18:52 | |
*** tiredbones has quit IRC | 18:54 | |
*** KP202 has quit IRC | 18:55 | |
*** filip101 has left #schooltool | 18:57 | |
tehminkeh | is there class today? | 18:58 |
jelkner | yes | 18:59 |
jelkner | i talked to the teacher yesterday | 18:59 |
jelkner | and he is planning on class today | 18:59 |
*** filip101 has joined #schooltool | 18:59 | |
jelkner | pcardune: morning teach! | 19:00 |
* jelkner is Jeff E. | 19:01 | |
pcardune | jelkner: Hi jelkner | 19:01 |
pcardune | hi everybody | 19:01 |
* filip101 is Filip S. | 19:01 | |
*** Preetam has joined #schooltool | 19:01 | |
* mlinnell is Mary L | 19:01 | |
* Preetam is Preetam D. | 19:02 | |
* bnguyen is Brittney N | 19:02 | |
* tehminkeh is Stephen Drodge | 19:02 | |
jelkner | hmm... where is everyone else? | 19:02 |
jelkner | only five people here so far? | 19:03 |
*** AVN` has joined #schooltool | 19:03 | |
pcardune | there is one more | 19:03 |
* AVN` is Chris Beacham | 19:03 | |
jelkner | OK, I'll start with announcements | 19:03 |
jelkner | next Saturday is the monthy sprint | 19:04 |
jelkner | several folks have said they are coming | 19:04 |
jelkner | it will be a good opportunity to get internship agreements processed | 19:04 |
jelkner | if you didn't receive an internship agreement last weekend, and will be home tomorrow afternoon between 4 and 6 pm | 19:05 |
jelkner | send me an email with your phone number and I'll call you tomorrow. | 19:05 |
jelkner | That's all I have to say, | 19:05 |
jelkner | I'm looking forward to seeing everyone's homework | 19:06 |
jelkner | take it away, pcardune | 19:06 |
pcardune | Ok, first thing first, did any of you add any features from what we did last week? | 19:06 |
pcardune | if so, start up your server and send us all a link showing what you did | 19:06 |
*** smalekgh has joined #schooltool | 19:07 | |
smalekgh | sorry I'm late, orthodontist went overtime | 19:07 |
* smalekgh is Masood M. | 19:07 | |
pcardune | orthodontists sure can be a pain | 19:07 |
smalekgh | <_< not in themselves, but I guess. | 19:07 |
jelkner | bnguyen: I know you have something to show us, I saw it yesterday ;-) | 19:07 |
pcardune | smalekgh: we are just about to look at improvements people made over the week | 19:08 |
bnguyen | well we made ours look better | 19:08 |
bnguyen | http://maddog.yhspatriot.net:8120/Contact%20Container | 19:08 |
pcardune | smalekgh: if you have something to show, send us a link | 19:08 |
smalekgh | um, what if I don't have much to show? As in, it's just what we've been doing over the lessons and I haven't done much to append to that? | 19:09 |
pcardune | bnguyen: that looks pretty wild | 19:09 |
pcardune | smalekgh: that's fine too | 19:09 |
bnguyen | i'll take that as a compliment | 19:09 |
pcardune | I'm glad you did that because today your are going to learn how to do it the zope3 way | 19:10 |
pcardune | well, if that's all people have to show, then we will move on to today's lesson | 19:11 |
smalekgh | uh, I'll send the link privately methinks | 19:11 |
smalekgh | still waiting for server startup <_< | 19:11 |
pcardune | oh ok | 19:11 |
pcardune | bnguyen: by the way, that was a compliment. I generally like darker themes. The default zope one is to corporate looking for my tastes (reminds me too much of microsoft's website) | 19:13 |
Preetam | haha | 19:13 |
* wjohnsto is William Johnston | 19:14 | |
pcardune | On that note, today we are going to learn how to develop custom skins for our application. | 19:14 |
jelkner | I was greatly looking forward to this show and tell | 19:14 |
jelkner | we will do it each week from now on | 19:14 |
wjohnsto | Sweet he liked our show and tell! | 19:14 |
jelkner | we need to find out where you all are at in the learning process | 19:15 |
pcardune | So far we have been using the ZMI to control our application, even though the ZMI provides much more functionality than we want. | 19:15 |
pcardune | So for the sake of our end users, we want to create our own simplified version of the ZMI that only has the functionality we require. | 19:15 |
jelkner | it is very important that you can demonstrate understanding of the class content | 19:15 |
jelkner | please have something to show next week | 19:16 |
jelkner | if you are stuck, you should be mailing in questions | 19:16 |
jelkner | ok, I'll stop now ;-) | 19:16 |
smalekgh | stuck is a relative term <_< | 19:16 |
jelkner | smalekgh: meaning? | 19:16 |
smalekgh | different magnitudes of being stuck. There's the stuck that takes two seconds and the stuck that takes 3 days but results in the sense of eureka-ness | 19:17 |
jelkner | smalekgh: if you only have a limited time to work on this, then get as far as you can, and ask questions freely | 19:17 |
jelkner | we are interested in your ability to make things work | 19:18 |
smalekgh | I think I'll be quiet now. | 19:18 |
pcardune | anyway... skins can be a somewhat complicated topic because the skinning architecture has several different parts that interact with each other to provide flexible skinning capabilities. | 19:18 |
pcardune | The first and somewhat all-encompassing part of skinning is a layer. | 19:18 |
pcardune | I like to think of layers as boxes that can contain a bunch of stuff, including other boxes. Primarily, the boxes/layers hold things we want to display on our web page. | 19:20 |
pcardune | These things or what we might call resources, can be anything from images to stylesheets to files to special views and macros. | 19:20 |
*** jelkner has quit IRC | 19:21 | |
pcardune | Although we have not used it yet, the configuration tags used to create pages and resources take an optional layer attribute which can be used to specify which layer they are in (or which box they are in). | 19:21 |
pcardune | does that kind of make sense to people so far? | 19:21 |
Preetam | yea | 19:21 |
mlinnell | sorta, yeah | 19:22 |
pcardune | The first part of this lesson is going to be some detailed eplanation of the skinning architecture | 19:22 |
pcardune | please ask questions if you have them | 19:22 |
pcardune | and wjohnsto has setup a teamspeak server if you are interested in using that to ask questions... | 19:22 |
pcardune | to continue, having multiple layers is especially useful when we have things like mutliple skins. | 19:22 |
pcardune | Imagine having a web application that was used by a bunch of different schools. Each school is going to want their own logo to appear in the application. Since we don't want to worry about all the different logos when writing the application, we simply create new layers for each of the schools. Then we can put a different logo image or stylesheet or anything into each of the schools' layer. | 19:23 |
pcardune | Then when the school logs in, zope will look up the logo image in the layer for that school. | 19:23 |
mlinnell | what's the difference between a layer and a skin? | 19:24 |
pcardune | that is a good question | 19:24 |
pcardune | in zope terminology, there is a subtle difference | 19:25 |
pcardune | but essentially, a layer is what you might think of as a "skin" in a more generic sense | 19:25 |
AVN` | so can you have multiple layers? | 19:25 |
pcardune | yes | 19:25 |
AVN` | at the same time | 19:25 |
pcardune | The really interesting part about layers is that they can inherit from other layers (like having boxes inside boxes). Then if zope doesn't find a logo image in a certain layer, it will look in the parent layers too. This way we could have a default logo if the school did not provide their own. | 19:25 |
AVN` | oh cool | 19:26 |
filip101 | so they sort of work like Java inheritance | 19:26 |
pcardune | fortunately though, since we aren't planning on deploying Z Contact with a bunch of different looks, we only need to create one layer. | 19:26 |
pcardune | or like python inheritance | 19:26 |
filip101 | where it keeps the old value and overwrites if you mention a new one | 19:26 |
filip101 | oh yeah... >_> | 19:27 |
pcardune | The other part of skinning with Zope3 is an actual skin itself. | 19:27 |
pcardune | and this case, i am talking about what is technically a "skin" in zope3 | 19:27 |
pcardune | In Zope terminology, the skin is what figures out which layer to use. | 19:27 |
pcardune | Remember how each school would see a different layer? We have to be able to tell Zope which layer to use and that is done with a skin. | 19:28 |
pcardune | The skin is in fact just a marker that gets attached to the request object (the users HTTP request from their web browser). Then when zope inspects the request object, it sees this special marker and looks for resources or views in one of the layers specified by the skin. | 19:28 |
pcardune | does that sort of make sense to people | 19:29 |
smalekgh | ... like a C pointer? | 19:29 |
pcardune | not quite | 19:29 |
pcardune | it is actually done using interfaces | 19:29 |
smalekgh | so it's like a pointer to virtual classes? | 19:29 |
pcardune | remember how an instace of a class can provide an interface? | 19:30 |
pcardune | and how you declare that it provides a given interface in the class definition? | 19:30 |
smalekgh | yes | 19:30 |
AVN` | no... | 19:30 |
pcardune | AVN`: i'm referring to the implements(zcontact.interfaces.IContact) line from the Contact class | 19:31 |
smalekgh | it's that thing where you say it provides yadda yadda and you can query it with some interface provided by yadayada | 19:31 |
pcardune | right | 19:31 |
pcardune | well you can make an object provide an interface outside of a class definition | 19:31 |
pcardune | So, zope is going to take this request object, and make it provide a certain interface (which defines our skin), and based on that it will be able to do the proper resource lookups | 19:32 |
pcardune | It's like adding a type to an object (except you can't do that in any programming language I'm aware of) | 19:33 |
pcardune | You might think of it as adding inheritance on the fly | 19:33 |
pcardune | which sounds pretty crazy | 19:33 |
AVN` | so its kinda like casting? | 19:34 |
AVN` | only permanant | 19:34 |
smalekgh | it's like casting an actual type, not even a reference <_< and without actually copying the item in question | 19:34 |
pcardune | like casting, but the request object still maintains it's old types | 19:34 |
pcardune | because with interface, an object can have multiple types | 19:34 |
pcardune | we'll look at an example soon enough | 19:35 |
pcardune | In the simplest case (which is our case), we are only going to have one layer and one skin. | 19:35 |
pcardune | The way that skins specify which layers should be looked in for a given resource is by inheritance. That is, if our skin wants to tell zope to look in layers A, B, and C, then the interface defining our skin would inherit layers A, B, and C (just like normal python inheritance). | 19:36 |
pcardune | This means that skins are actually layers too. You might think of them as a grouping of other layers. (remember the question, "what's the difference between a layer and a skin...") | 19:36 |
pcardune | So enough talk, let's get to creating our skin. As I said earlier, skins are just marker interfaces. So open up the interfaces.py file and create an interface called IZContactSkin. | 19:37 |
pcardune | Now, the only layer we want to inherit from is the default layer. The default layer is the layer that things get registered for when you don't specify a layer in the configuration tag. | 19:38 |
pcardune | At the moment, all our pages, and all of zope's views as well, are registered on this default layer. | 19:38 |
smalekgh | so, it's just a regular old interface, no bells and whistles interface inhertance like the container interface? | 19:40 |
AVN` | What is the name of the default interface? | 19:40 |
smalekgh | zope.interface.Interface methinks | 19:40 |
smalekgh | oh, oops, wrong question | 19:40 |
AVN` | oh wait, I meant default layer | 19:41 |
pcardune | zope.publisher.interfaces.browser.IDefaultBrowserLayer | 19:41 |
pcardune | At the moment, all our pages, and all of zope's views as well, are registered on this default layer. And even though we are writing our own custom skin, we will still want to be able to use a lot of the views zope provides for us (which live in the default layer). | 19:41 |
pcardune | my interface definition looks like this: class IZContactSkin(zope.publisher.interfaces.browser.IDefaultBrowserLayer): | 19:42 |
pcardune | """The ZContact skin.""" | 19:42 |
pcardune | That's it. That is our skin. So any request object that provides the IZContactSkin interface will use our skin. | 19:42 |
pcardune | So how does a request object go about providing this interface? Well, zope has this handy thing called a traversal adapter. | 19:43 |
pcardune | I won't explain how those work yet, but essentially it allows us to specify which skin to use through the url. | 19:43 |
pcardune | This is what the url would look like: http://localhost/++skin++ZContact/path/to/whatever. | 19:43 |
pcardune | When zope traverses this url, that is, when zope looks up the url, it will see the ++skin++ part and know that what follows is the name of the skin to use. It will then lookup the interface for that name, and make the request object provide that interface. Then zope machinery handles the rest. | 19:44 |
pcardune | does that sort of make sense? | 19:44 |
pcardune | does everyone know what I mean by "Traversal"? | 19:44 |
Preetam | not exactly... | 19:45 |
smalekgh | a trek up inheritance hill? | 19:45 |
pcardune | good pun, but no not quite | 19:45 |
pcardune | but think about traversing across the united states | 19:45 |
pcardune | you have a path, or a route, that says all the places you will go to in between | 19:45 |
mlinnell | it's like when you go over something, you traverse it? | 19:46 |
pcardune | first you go to new york, then chicago, the, Denver, then San Francisco | 19:46 |
pcardune | those are all parts of the path | 19:46 |
pcardune | now think of a url... | 19:46 |
pcardune | a url *is* a path | 19:46 |
pcardune | and it is traversed in the same way | 19:46 |
pcardune | first it looks at the first part of the url (which is ++skin++ZContact) | 19:46 |
pcardune | zope says to itself "oh! there they are asking for a custom skin called ZContact" | 19:47 |
pcardune | zope looks up that skin, applies it to the request object, then continues traversing | 19:47 |
smalekgh | so, can you skin things differently throughout the url? | 19:48 |
pcardune | it goes to the next part in the url (in the example above that would be "path") and then tries to look up the "path" object in the root directory | 19:48 |
AVN` | and if it can't find that skin? | 19:48 |
pcardune | if it can't find that skin then you get a page not found error | 19:48 |
pcardune | just like if you are traversing the United states, and you cant find New York, you are in big trouble | 19:48 |
pcardune | there is no way you will make it to san francisco | 19:48 |
AVN` | what if the request object isn't able to implement the skin | 19:49 |
pcardune | but why wouldn't it be able to do that? | 19:49 |
pcardune | our skin interface doesn't ask for any attributes or methods | 19:49 |
AVN` | oh, ok | 19:49 |
pcardune | *any* class would succeed in implementing that interface | 19:49 |
pcardune | that is why it is called a "marker interface" | 19:50 |
smalekgh | so, can you skin things differently throughout the url? | 19:50 |
pcardune | yep | 19:50 |
pcardune | so a traversal adapter is just a customization of the normal way zope traverses a url | 19:50 |
pcardune | which makes url handling *very* *rediculously* flexible | 19:51 |
lisppaste5 | wjohnsto pasted "contactcontainer.pt" at http://paste.lisp.org/display/37985 | 19:51 |
smalekgh | you make it sound almost unfair. | 19:51 |
pcardune | think of some of the web applications you use where part of a url is a long alphnumeric string like AEF37E372BDC738.... | 19:52 |
pcardune | those web applications are not serving up a file with that name... rather they decode that long string and turn it into something useful... then serve up whatever it is you are looking for | 19:52 |
smalekgh | like logging in to gmail, that uber long php/js/whatever it is thinger at the end? | 19:52 |
pcardune | yeah | 19:53 |
pcardune | you can make zope do that too | 19:53 |
pcardune | Now that you know what I mean be "traversal", lets add some configuration | 19:53 |
pcardune | To give our skin a name so it can be accessed through the URL, we have to register it in our configure.zcml file. Open up configure.zcml and add the following tag: | 19:53 |
pcardune | <interface | 19:54 |
pcardune | interface="zcontact.interfaces.IZContactSkin" | 19:54 |
pcardune | type="zope.publisher.interfaces.browser.IBrowserSkinType" | 19:54 |
pcardune | name="ZContact" | 19:54 |
pcardune | /> | 19:54 |
pcardune | This tells zope that the skin we made is in fact a skin (that is the IBrowserSkinType part) and that the skin can be looked up using the name ZContact. | 19:55 |
pcardune | With that written, we can access our skin through a url. I would recommend restarting our zope server now and checking it out. Go to any place in the ZMI, then add ++skin++ZContact to the beginning of the url (just after the server:port) and see what the page looks like using our skin. | 19:56 |
pcardune | someone should provide the rest of us with a link using that skin | 19:57 |
AVN` | won't it look the same as without the skin? | 19:57 |
pcardune | try it | 19:57 |
AVN` | cause we didn;t change anything? | 19:57 |
pcardune | you will see when you try it out... | 19:58 |
smalekgh | 20 imaginary money units on there being nothing on the page | 19:58 |
pcardune | you're on smalekgh | 19:59 |
pcardune | :) | 19:59 |
AVN` | lol, I think I will side with pcardune | 19:59 |
mlinnell | http://maddog.yhspatriot.net:8111/++skin++ZContact/ContactContainer | 19:59 |
smalekgh | it appears I owe someone some imaginary money | 19:59 |
pcardune | :) | 20:00 |
smalekgh | does the default browser interface actually have an implementation that the skin connects to? | 20:00 |
pcardune | no | 20:00 |
pcardune | what happened here is that the views providing the look and feel of the normal interface are not registered for the default layer | 20:01 |
bnguyen | ConfigurationError: ('Invalid value for', 'type', "ImportError: Couldn't import zope.publisher.interfaces.browser.IBrowser, No module named IBrowser") | 20:02 |
pcardune | they are registered in the Rotterdam layer (Rotterdam is the name of the default skin in zope... try ++skin++Rotterdam, there is also Basic, ZopeTop | 20:02 |
pcardune | and Boston | 20:02 |
AVN` | why rotterdam? | 20:02 |
pcardune | bnguyen: you want zope.publisher.interfaces.browser.IDefaultBrowserLayer | 20:03 |
smalekgh | could you explain the last 23 words of that sentence on the view providing the look and feel not being registered, please? | 20:03 |
pcardune | i'm not sure... maybe the person who designed the skin is from Rotterdam? | 20:03 |
pcardune | yes | 20:03 |
pcardune | what i mean by look and feel is a macro | 20:03 |
pcardune | we will do macros next | 20:03 |
AVN` | oh zopetop is nice | 20:03 |
pcardune | but basically, the macro that gives us the rotterdam skin is in the rotterdam layer, | 20:04 |
pcardune | since our skin doesn't inherit from the rotterdam layer, we dont get to use any of rotterdam's macros | 20:04 |
pcardune | the default layer has the Basic skin | 20:05 |
pcardune | so that is what we see | 20:05 |
pcardune | So now let's talk about macros | 20:05 |
pcardune | Macros are what people might normally think of when you say skin because it defines how and what things get layed out on the screen. It is the visual part of a skin. | 20:06 |
pcardune | Macros are defined in the same way that we create page templates. In fact, you might think of them as meta templates - templates for templates. | 20:06 |
pcardune | Remember in lesson 3 when we had the line <html metal:use-macro="context/@@standard_macros/view">? Most views in Zope use the view macro, which is specified in the standard_macros view. | 20:07 |
pcardune | So if we want our skin to work with existing zope components, we will make our own standard_macros view, with our own view macro. | 20:09 |
pcardune | Notice that @@standard_macros is just a view lookup. Remember that a view is a lot like a page with a class and template. The first thing we need to do to create macros is add a standard_macros page to the new layer we created, IZContactSkin. So go back to your configure.zcml file and add the following lines: | 20:11 |
pcardune | <browser:page | 20:11 |
pcardune | for="*" | 20:11 |
pcardune | name="standard_macros" | 20:11 |
pcardune | template="zcontactmacros.pt" | 20:11 |
pcardune | permission="zope.View" | 20:11 |
pcardune | layer="zcontact.interfaces.IZContactSkin" | 20:11 |
pcardune | /> | 20:11 |
pcardune | does anyone have questions about this zcml registration? | 20:12 |
smalekgh | * = all? | 20:12 |
smalekgh | like the truncatable replaceable thingy in online databases? | 20:13 |
pcardune | yep | 20:13 |
pcardune | we want this page to be available no matter what object we are looking at | 20:13 |
pcardune | Now we need to write the actual page template. As we specified in zcml, we need to create a new file called zcontactmacros.pt. The first macro we want to create should be called view. Start by writing the following: | 20:15 |
pcardune | <html metal:define-macro="view"> | 20:16 |
pcardune | Hello World For Macros! | 20:16 |
pcardune | </html> | 20:16 |
AVN` | whats the metal for? | 20:16 |
pcardune | Notice that for anything involving macros, we use the metal namespace. | 20:16 |
pcardune | metal... think meta-tal | 20:17 |
*** wjohnsto has left #schooltool | 20:17 | |
*** wjohnsto has joined #schooltool | 20:17 | |
pcardune | the tal namespace provides attributes for plugging in bits of content, so the meta-tal namespace provides attribtues for plugging in bits of templates | 20:17 |
pcardune | Now restart your server and open up any page using this skin. You should get an empty screen that just says "Hello World For Macros!" | 20:18 |
pcardune | If you look at the other page templates we have created, like viewcontact.pt, you will see other metal attributes, like metal:fill-slot. In our macro we can define slots where content will go. | 20:19 |
pcardune | Page templates which use the macro can then fill those slots using the fill-slot attribute. To create a slot we use the define-slot attribute in our macro. So, we might want to add a default header to our macro, then present the information from the body slot. | 20:19 |
pcardune | Edit your viewcontact.pt file to look like this: | 20:20 |
pcardune | <html metal:define-macro="view"> | 20:20 |
pcardune | <head><title>ZContact</title></head> | 20:20 |
pcardune | <body> | 20:20 |
pcardune | <h1>Z Contact</h1> | 20:20 |
pcardune | <h4>The Hottest Contact Manager on the Planet</h4> | 20:20 |
pcardune | <hr /> | 20:20 |
pcardune | <div metal:define-slot="body"> | 20:20 |
pcardune | Hello World For Macros! | 20:20 |
pcardune | </div> | 20:20 |
pcardune | </body> | 20:20 |
pcardune | </html> | 20:20 |
pcardune | I'm going to give you all 10 minutes to play around with the macro | 20:24 |
pcardune | remember that you can put bits to tal in the amcro to | 20:24 |
pcardune | try putting <span tal:content="context" /> somewhere in the macro and see what happens | 20:25 |
smalekgh | you don't have to restart the zope server after changing the .pts, right? | 20:26 |
pcardune | correct | 20:26 |
smalekgh | is there any way to have a second putty window logged on to maddog while the other window runs zope, so I don't have to close zope in order to access the .pts? | 20:27 |
AVN` | yes, you can do that | 20:27 |
pcardune | yes | 20:27 |
pcardune | just open up another putty window :) | 20:27 |
smalekgh | it complained last time I tried <_< | 20:28 |
smalekgh | oh, wow | 20:28 |
AVN` | so I tried <span tal thing, and I got a system error | 20:31 |
Preetam | i did the span thing and i got <security proxied zcontact.contact.Contact instance at 0xf61fba08> | 20:32 |
pcardune | Preetam: you got what you would should expect | 20:33 |
Preetam | oh ok | 20:33 |
pcardune | AVN`: ask Preetam | 20:33 |
smalekgh | oh yay, more memory addresses | 20:33 |
pcardune | that is actually the context of the view | 20:33 |
pcardune | try context/__name__ | 20:33 |
pcardune | or context/__parent__ | 20:34 |
pcardune | and try looking at the skin from different views | 20:34 |
smalekgh | server error occured when I tried to get the context/__name__ | 20:34 |
pcardune | try looking at different views, it may work on other objects | 20:35 |
smalekgh | how does zope handle a server 'error'? Is it really an 'error' or just something zope notices and decides not to pursue? | 20:37 |
pcardune | it is really an error | 20:37 |
pcardune | i mean, the server wont crash like a normal program, because zope catches the errors, but it is a thrown python exception | 20:37 |
smalekgh | oh | 20:38 |
smalekgh | okay | 20:38 |
pcardune | you can get the python traceback for the exception by looking at the terminal where zope is running | 20:38 |
AVN` | yeah its a transversal error | 20:39 |
smalekgh | I'm actually starting to get semi-sick of the word 'traversal'... | 20:39 |
pcardune | but traversal is such a cool idea | 20:40 |
smalekgh | true | 20:40 |
pcardune | ok, well I want to finish one more thing before i let you guys go discover more about macros | 20:42 |
pcardune | we are going to want to use some cascading style sheets. Casecading style sheets present an excellent usecase for resources. | 20:42 |
pcardune | In zope, a resource is just a file that lives on the server's file system, and not in Zope's object database. These might include CSS files, images, javascript libraries, and more. Since I generally use quite a number of resources in my web applications, I like to have a folder where I keep all the resources. So go ahead and create a new directory within zcontact called resources. Then we need to register this directory as containing a bu | 20:42 |
pcardune | nch of resources. | 20:42 |
smalekgh | what was the unix command for making a folder? mk-dir? dirmk? | 20:43 |
filip101 | mkdir | 20:43 |
pcardune | mkdir | 20:43 |
smalekgh | oh. | 20:43 |
AVN` | mkdir | 20:43 |
AVN` | too late | 20:44 |
smalekgh | finally, a spot of blue in a window of too many gray-text file-names >_< | 20:44 |
pcardune | open up configure.zcml and add the following tag: | 20:45 |
pcardune | <browser:resourceDirectory | 20:45 |
pcardune | directory="resources" | 20:45 |
pcardune | name="zcontact_resources" | 20:45 |
pcardune | layer="zcontact.interfaces.IZContactSkin" | 20:45 |
pcardune | /> | 20:45 |
pcardune | Now lets add a link to the css file in our html code: | 20:47 |
pcardune | <link rel="stylesheet" type="text/css" | 20:47 |
pcardune | href="/@@/zcontact_resources/style.css" | 20:47 |
pcardune | tal:attributes="href context/++resource++zcontact_resources/style.css"/> | 20:47 |
pcardune | this would go in zcontactmacros.pt | 20:47 |
pcardune | inside the head tag | 20:47 |
pcardune | have all of you used cascading style sheets before? | 20:47 |
smalekgh | invisionfree.com's forum skinning count? | 20:47 |
pcardune | is it css? | 20:48 |
smalekgh | it looked big and made me fallover in dread... Yeah I believe so | 20:48 |
mlinnell | yeah I've used CSS | 20:49 |
AVN` | I never have | 20:49 |
pcardune | well it is a nice thing to learn when you are doing a bit of web development | 20:51 |
pcardune | it also isn't that hard at all | 20:51 |
pcardune | make your resources/style.css file look like this: | 20:52 |
pcardune | body { | 20:52 |
pcardune | padding: 1em; | 20:52 |
pcardune | } | 20:52 |
pcardune | h1 { | 20:52 |
pcardune | color: #f00; | 20:52 |
pcardune | } | 20:52 |
pcardune | hr { | 20:52 |
pcardune | border: 1px dotted red; | 20:52 |
pcardune | } | 20:52 |
pcardune | then restart your zope server so the resources get loaded and take a look at the page again | 20:53 |
pcardune | now we have some nice colors | 20:53 |
smalekgh | Ahhh! My eyes! They burrrnnn! The color hast turned reddened! But uh, where'd the border go? | 20:57 |
pcardune | the border is just that horizontal rule | 20:58 |
pcardune | so that is pretty much the end of class | 20:58 |
pcardune | for next week I want you guys to look into CSS a bit, and look at doing a few more things with macros | 20:58 |
filip101 | so we're getting to the fun visual stuff :) | 20:59 |
pcardune | Look at the ZPT reference on the zope website for more information on macros | 20:59 |
pcardune | yes | 20:59 |
smalekgh | visual? As in... | 20:59 |
pcardune | Also, try adding new features | 20:59 |
smalekgh | MS Visual C++? THE EYES! THEY BURRRNNN | 20:59 |
smalekgh | oh, sorry. | 20:59 |
pcardune | Show off what you have learned so far | 20:59 |
pcardune | and if you have any questions at all, email me | 21:00 |
pcardune | or email the whole class | 21:00 |
pcardune | or both is best | 21:00 |
pcardune | if you email the class list then I will get the email too | 21:00 |
*** bnguyen has left #schooltool | 21:01 | |
* smalekgh bows out | 21:01 | |
smalekgh | logout | 21:01 |
smalekgh | durnit | 21:01 |
smalekgh | ... I'll just clos the window manually then <_< | 21:01 |
*** smalekgh has left #schooltool | 21:01 | |
Preetam | alright, thanks! | 21:02 |
*** AVN` has left #schooltool | 21:02 | |
*** Preetam has left #schooltool | 21:02 | |
mlinnell | thanks | 21:02 |
*** mlinnell has quit IRC | 21:02 | |
*** tehminkeh has left #schooltool | 21:06 | |
*** pcardune has quit IRC | 21:10 | |
*** filip101 has left #schooltool | 21:13 | |
*** th1a has quit IRC | 22:48 | |
*** th1a has joined #schooltool | 22:50 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!