Re: [Zope] a couple of basic questions

2007-06-20 Thread JPenny
[EMAIL PROTECTED] wrote on 06/19/2007 08:20:44 PM:

 Hi, thank you for taking the time to read this.
 
 1. I'm trying to learn to write a website using zope, the progress 
 is good but i need to understand how can i call an zope object (ZPT 
 or SQL or Script) from a script in this setup: 
 
 /root
 /mysite
  /db
 sql_do_something
  /script
 call_sql_do_something
  index_html
 
 
 i tryed to call it using sql_do_something = 
 context['db/sql_do_something'] hoping that maybe using aquisition 
 ... i can get the script ... but i get the message that he can't 
 find the object. 

Maybe context['db']['sql_do_something'].  I don't remember. 

 
 the only way i managed to call it is ... if the files are in the same 
dir.
 im currently using them this way ... but it's gonna get a mess soon,
 all those scripts and sql and ZPT in the same dir.

I actually want all of them bundled.  I do a folder per project, and 
generally
want most of the non-pervasive stuff necessary for a single application in
a single folder, the logic being that I know where to start looking when a 
problem
or extension request happens.

Most folders are 50 to 100 objects, and it just hasn't been an issue to 
me.
The worst is nearing 600 objects, which is teetering on the edge.

 
 2. I'm not writing products, just simple ZPT and script ... and i 
 want version control for them, i have svn installed but ... the 
 files are all inside zope database (i don't even know how the 
 database file is named). Is there a svn plugin or a way to add those
 files to repository?  I think that adding the entire zope database 
 is a bit awkward ... hard to diff etc. 

Yes, look at FileSystemSite (http://www.infrae.com/download/FileSystemSite 
for
source).  Or you can install CMF.  I seriously wish that FileSystemSite 
would
be moved into Zope core.

There are older methods of syncing the ZODB to cvs.  Generally, these are
to be avoided, they work fine when they work, but when they fail they are
difficult to resync.

jim penny
 
 3. Almost the same as the svn problem ... i want to backup my files 
 from time to time .. db and code, i know how to backup my mysql db, 
 but i don't know how to get the zope files.
 I think i i find the answer for the question nb 2, number 3 will be the 
same. 
 
 Thank you, expert Zope programmers.
 
 
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] a couple of basic questions

2007-06-20 Thread Andrew Milton
+---[ Tudor Gabriel ]--
| Hi, thank you for taking the time to read this.
| 
| 1. I'm trying to learn to write a website using zope, the progress is good but
| i need to understand how can i call an zope object (ZPT or SQL or Script) from
| a script in this setup:
| 
| /root
| /mysite
|  /db
| sql_do_something
|  /script
| call_sql_do_something
|  index_html
| 
| 
| i tryed to call it using sql_do_something = context['db/sql_do_something']
| hoping that maybe using aquisition ... i can get the script ... but i get the
| message that he can't find the object.

script:
results = context.db.sql_do_something(some_arguments)


| 3. Almost the same as the svn problem ... i want to backup my files from time
| to time .. db and code, i know how to backup my mysql db, but i don't know how
| to get the zope files.
| I think i i find the answer for the question nb 2, number 3 will be the same.

As a lowest common denominator, you can ftp them out...

-- 
Andrew Milton
[EMAIL PROTECTED]
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] a couple of basic questions

2007-06-20 Thread Paul Winkler
On Wed, Jun 20, 2007 at 10:02:01AM -0400, [EMAIL PROTECTED] wrote:
  i tryed to call it using sql_do_something = 
  context['db/sql_do_something'] hoping that maybe using aquisition 
  ... i can get the script ... but i get the message that he can't 
  find the object. 
 
 Maybe context['db']['sql_do_something'].  I don't remember. 

Close but no cigar.  Dictionary-style item access does NOT use
acquisition:

   foo['bar']['baz'] works iff bar is in foo and baz is in bar.

Object-style attribute access DOES use acquisition:

   foo.bar.baz works if bar is in (or can be acquired by) foo, and baz
   is in (or can be acquired by) bar.

Finally, restrictedTraverse() is your friend:

   foo.restrictedTraverse('bar/baz') works like foo.bar.baz


-PW

-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] a couple of basic questions

2007-06-19 Thread Tudor Gabriel

Hi, thank you for taking the time to read this.

1. I'm trying to learn to write a website using zope, the progress is good
but i need to understand how can i call an zope object (ZPT or SQL or
Script) from a script in this setup:

/root
   /mysite
/db
   sql_do_something
/script
   call_sql_do_something
index_html


i tryed to call it using sql_do_something = context['db/sql_do_something']
hoping that maybe using aquisition ... i can get the script ... but i get
the message that he can't find the object.

the only way i managed to call it is ... if the files are in the same dir.
im currently using them this way ... but it's gonna get a mess soon, all
those scripts and sql and ZPT in the same dir.

2. I'm not writing products, just simple ZPT and script ... and i want
version control for them, i have svn installed but ... the files are all
inside zope database (i don't even know how the database file is named). Is
there a svn plugin or a way to add those files to repository?  I think that
adding the entire zope database is a bit awkward ... hard to diff etc.

3. Almost the same as the svn problem ... i want to backup my files from
time to time .. db and code, i know how to backup my mysql db, but i don't
know how to get the zope files.
I think i i find the answer for the question nb 2, number 3 will be the
same.

Thank you, expert Zope programmers.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )