[Zope] How can i call a pyhton module's function from with in Page Temmplates?

2005-10-12 Thread Thomas Apostolou
Hello,

i saw that from within a DTML Method one is able to
call a fuction of a python module in the file system.

Now i want to get the funtion's results from within a
Page Template.
Is the right way to make a Script(Python) that calls
this module's function and then call this
Script(Python) from within my Page Template?
Is there any other less nifty way to do this?

Thanks in advance.






___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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] How to show the DTML Method's results within Plone?

2005-10-11 Thread Thomas Apostolou
Hello again...

i have a DTML Method like you can see bellow that
produces a table after quring some table (using python
GetHeader and GetData custom modules)
But the result is a table with the query results in
another page.
I would like to show the table with the query results
within Plone's enviroment.
How can i do this?

Thank you very much!!!





Re: [Zope] How to make a table with sortable colmns?

2005-10-10 Thread Thomas Apostolou
Thank you all.
You have helped ance again.
after reading the article above i understood that apart from writing 
 

 
i sould also import this 2 js files wich makes my page understand what class="listing" means in order to behave like i would expect it to.
 

[Zope] How to make a table with sortable colmns?

2005-10-07 Thread Thomas Apostolou
Hello all,
i am using the following to get some data from
Database
and show them in a table:




<!-- @import
url(/plone.css); -->
<!-- @import
url(/ploneColumns.css); -->
<!-- @import
url(/ploneCustom.css); -->


  

  

    

  

  

  

  

  
  


  
  





But how can i tell the table to sort the column i
click on just like plone does with the members list?

Thanks in advance

Thomas Apostolou






___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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] How to show field n ames from sql query?

2005-09-19 Thread Thomas Apostolou
"TestODBCEM" is an external method that uses a python
module with a function named "TestODBCEM". This
function uses the parameters sysDSN, usr, mypass, sSQL
to connect to the sysDSN with user name usr, password
mypass and execute sSQL query. After that it returns
the results witch i show in a table.


--- Tino Wildenhain <[EMAIL PROTECTED]> wrote:

> Thomas Apostolou schrieb:
> > Hello all,
> > i use the following to get to show the results
> from an
> > sql query.
> > What are the expresions to show the field names?
> > 
> > 
> >   
> > 
> >   
> > 
> >   
> > 
> > 
> >   
> > 
> > 
> >   
> > 
> > 
> 
> See:
>
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/RelationalDatabases.stx#3-107
> 
> particulary result.data_dictionary() which gives
> you the names of the columns.
> 
> I'm not sure what you mean with the DSN in your
> example above.
> For me it does not look correct. ZSQL methods
> do not deal with databases and connections directly
> but
> rather use a central connection object.
> 







___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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] How to show field names from sql query?

2005-09-19 Thread Thomas Apostolou
Hello all,
i use the following to get to show the results from an
sql query.
What are the expresions to show the field names?


  

  

  


  


  


Thanks in advance.
Thomas.






___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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] fro m REQUEST not shown in tag if it has spaces??

2005-08-04 Thread Thomas Apostolou

--- Tino Wildenhain <[EMAIL PROTECTED]> έγραψε:

> 
> Yes, you should write HTML when you want HTML ;)
> This means, attribute values in HTML are supposed
> to be in " "
> (See the HTML source in your Browser when you
> display
> the page and you will know what I mean :)
> 
> So, if you really want DTML here, use:
> 
> 
> 
> or 
> 
> 
> 
> which is a bit nicer because you dont write a tag
> inside
> a tag.
> 
> OR use ZPT:
> 
> 
> 
> 
> 
> 

was that a realy stupid question or what? 8-<
Thanks anyway,
Thomas Apostolou






___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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: Re: [Zope] Cannot pass parameters to Externa Method From inside a DTML Method

2005-08-04 Thread Thomas Apostolou
> This is not a good idea anyway.
> 1) it lets every user knowing the external method
>connect to every database on your host (depending
> 
>on credentials if any)
> 
> 2) even worser it enables the user to issue any
>raw SQL string to the database, including but not
>limited to DROP table; DROP database; etc.

This is not be the real thing on the site. It is just
what i develop and see. The site is not up yet and the
interface and the credentials are not set. I just have
the spefific interface now for
trying-testing-learning.
I can see your point and agree 100%

> 
> 3) by not using ZOPEs infrastructure (read:
> Z(yourdb)DA,
>ZSQL-Methods), you have the expensive connect
> operation
>every time, loose the ability to easily work with
> zopes
>transactions, have to quote and unquote values
> and so on.
> 
> So get a ZODBCDa or something like that and use it.

I have allready used that and i am trying what i wrote
just for learning some python and do some custom
things.
I am sure you are right and sooner or later i will
also prefer what you suggest (when i know more about
what zopes transactions etc. are about) after reading
some more on the Zope book.

> 
> here you would write:
> 
> 
> 
> because your external Method does not magically 
> read the REQUEST object. (You could do that there
> by using self.REQUEST.get('sysDSN','default') )

I knew that it should be some other way that the
correct syntax should be used. i had wrote 

witch was realy wrong and maybe stupid, but i'm sure
i'll get better soon with that kind of community and
documentation. I am realy sory if i ask some stupid
questions but as i told you i will soon get better.
Thank you  very much for both DTML and Python.

> See also:
> 
>
http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx
> 
> 
> 
> -- 
> Tino Wildenhain <[EMAIL PROTECTED]>


Thank you for your precious help on this.

Thomas Apostolou






___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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] from REQUEST not shown in tag if it has spaces??

2005-08-04 Thread Thomas Apostolou
Hello everybody,

Im using Zope 2.7.0 on Windows XP Pro.
I pass some parameters from a form to a DTML method.
Inside that method i try to get the parameters with
 ( sSQL is the "name" of the submiting
form's field).
When i just use it as  everything is
ok.
When i use it like : >, i get everything until the
first space. For example from "select * from mytable"
i get "select".

Is it something wrong with what i am doing?


Thank you in advance







___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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] Cannot pass parameters to Externa Method From inside a DTML Method

2005-08-04 Thread Thomas Apostolou
I have in my "Extensions" folder the file
"TestODBCEM.py" witch contains the following code to
select and return 40 rows by 8 columns of a query:


def TestODBCEM(self, sysDSN="defDSN", usr="defUsr",
mypass="defPass", sSQL="SELECT * FROM defTable",
xx=40, yy=8):
   id = self.id
   import dbi
   import odbc
   connection=odbc.odbc(sysDSN+'/'+usr+'/'+mypass)
   cur=connection.cursor()
   cur.execute(sSQL)
   data=cur.fetchall()
   a=""
   for x in range(0,int(xx)):
  for y in range(0,int(yy)):
 if data[x][y]=="":
a=a+"Null"+"---"
 else:
a=a+str(data[x][y])+" --- "
  a=a+"\n"
   return data



I have used it and created an External Method in my
Zope name "TestODBCEM"



next i created a DTML Method named
"GetQueryParamsDTML" with the following :




  I will connect using : "" System DSN
  Type the query to execute...
  
>
The SQL Query to be executed against the above
DSN connection

 >
 >

   



and everything is ok as it returns something like this
:
[(1, 1054, 1001, '\xc1\xd0\xcf\xd3\xc2', 1001, 101,
'\xc1\xd0\xcf\xd3\xc2\xc5\xd3\xc5\xc9\xd3
\xd7\xd1\xc7\xd3\xc7\xd3', None, 1, None, None, None,
None, None, 1, 1, 0, None, None, None, None, None,
1054, 1054, 1, 0, 0, 0, None, None, None, 0, None,
None, None, 0, None, None, None, 0, 0, 0, None, None,
None, 0, 0), (1, 1054, 9001, '\xc1\xd0\xcf\xd.

Now i want to format the results to show them
so i change my "GetQueryParamsDTML" as follows:




  I will connect using : "" System DSN
  Type the query to execute...
  
>
The SQL Query to be executed against the above
DSN connection

 >
 >

   
 

Now it calls another DTML Method named "ShowResults"
witch reads like this:




  

  

  
  

  
  




The problem know is that, althought the params of the
GetQueryParamsDTML is passed to ShowResults through
the REQUEST, the TestODBCEM does not use them. Instead
the code is always using the defValues of its def
line.
When i was calling ./TestODBC from GetQueryParamsDTML 
it was using the parameters i was submiting.

I tried to change the follong line of ShowResults :

to:


but this one gives me an AttributeError ('str' object
has no attribute 'id').



Does anyone know what am i doing wrong?
I would apreciate it if you could help me.

I use Zope 2.7.0 on windows XP PRO, witch i use after
installing Plone 2.0.5 executable installer.
It uses Python 2.3.3


Thanks in advance.

Thomas Apostolou






___ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

___
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 )