Re: PHP + TinyButStrong Python replacement

2008-05-09 Thread Bruno Desthuilliers

pistacchio a écrit :

[EMAIL PROTECTED] ha scritto:

On 7 mai, 16:17, pistacchio [EMAIL PROTECTED] wrote:

George Sakkis ha scritto:

(snip)

What does it matter if it's a single file or a dozen under a package ?
Installation for pure Python packages can be as simple as copying
the package under any directory in your PYTHONPATH.

well, it doesn't matter if it's a single file or a package, but it
_does_ matter if you have to put them under the path where python is
installed because, in a typical shared web hosting environment (such the
one that i use) you don't have access to system directories.


You *never* have to install anything in the default path - install
your python libs wherever you want, and just make sure this wherever
is in your python path (usually via the PYTHONPATH environment
variable).



again, in a shared environment, you don't have access to environment 
variables.


Depends on the shared environment. But even if you can't set 
PYTHONPATH, you can always import sys and append (or prepend) to 
sys.path before doing any other import.


 all you can do is copy files in your own little directory,
and that's it. this directory is never something like /share/python, but 
something like /home/averagejoe. and /home/averagejoe is not usually in 
the PYTHONPATH



Check out Mako (http://www.makotemplates.org/), it's pretty powerful
and fast.

woudl you suggest mako over cheetah?





As far as I'm concerned, I would.  Now if you're looking for a
somewhat barebone MVC framework, you may want to have a look at
web.py.



i've tried mako. sees to work fine for me, both for its potential and 
for its installation method. in fact i just copied it under my own 
directory


/home/averagejoe
  test.py
  /mako
mako stuff

and the following testcase worked well:

from mako.template import Template
mytemplate = Template(hello world!)
print mytemplate.render()

can i do the same with web.py?


Can't tell, never used it. But how to deploy it is very certainly 
documented on the project's page.


mind that i work under an apache 
environment (mod_python).


mod_python ? Fine. And, if I may ask, did you actually took time to read 
the FineManual(tm) ?-)


http://www.modpython.org/live/mod_python-3.3.1/doc-html/dir-other-pp.html


now, back to mako. can you provide an example of blocks and nested 
blocks in mako? the documentation doesn't seem to be too clear in this 
reguard.


for example, if i want to show a table with a list of restaurants 
(gathered from a db query), i can construct a template like this:


table
% for rest in restaurants:
  tr${rest}tr
% endfor
/table

but what if if each restaurant has a list of dishes (pasta, pizza, meat, 
pie)


Depends... What kind of object is 'rest' ? How is this list named ?


and some (or each) dish has the ingrediets?


Same question.

is it just like 
embedding pure python into the template ( like $(rest['dish'])  and 
$rest['dish']['ingredient']) )?


What goes inside ${} are ordinary Python expressions, yes.

--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-08 Thread pistacchio

[EMAIL PROTECTED] ha scritto:

On 7 mai, 16:17, pistacchio [EMAIL PROTECTED] wrote:

George Sakkis ha scritto:

(snip)

What does it matter if it's a single file or a dozen under a package ?
Installation for pure Python packages can be as simple as copying
the package under any directory in your PYTHONPATH.

well, it doesn't matter if it's a single file or a package, but it
_does_ matter if you have to put them under the path where python is
installed because, in a typical shared web hosting environment (such the
one that i use) you don't have access to system directories.


You *never* have to install anything in the default path - install
your python libs wherever you want, and just make sure this wherever
is in your python path (usually via the PYTHONPATH environment
variable).



again, in a shared environment, you don't have access to environment 
variables. all you can do is copy files in your own little directory, 
and that's it. this directory is never something like /share/python, but 
something like /home/averagejoe. and /home/averagejoe is not usually in 
the PYTHONPATH



Check out Mako (http://www.makotemplates.org/), it's pretty powerful
and fast.

woudl you suggest mako over cheetah?





As far as I'm concerned, I would.  Now if you're looking for a
somewhat barebone MVC framework, you may want to have a look at
web.py.



i've tried mako. sees to work fine for me, both for its potential and 
for its installation method. in fact i just copied it under my own 
directory


/home/averagejoe
  test.py
  /mako
mako stuff

and the following testcase worked well:

from mako.template import Template
mytemplate = Template(hello world!)
print mytemplate.render()

can i do the same with web.py? mind that i work under an apache 
environment (mod_python).


now, back to mako. can you provide an example of blocks and nested 
blocks in mako? the documentation doesn't seem to be too clear in this 
reguard.


for example, if i want to show a table with a list of restaurants 
(gathered from a db query), i can construct a template like this:


table
% for rest in restaurants:
  tr${rest}tr
% endfor
/table

but what if if each restaurant has a list of dishes (pasta, pizza, meat, 
pie) and some (or each) dish has the ingrediets? is it just like 
embedding pure python into the template ( like $(rest['dish'])  and 
$rest['dish']['ingredient']) )?


thanks for you interest
--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-08 Thread Jeroen Ruigrok van der Werven
-On [20080507 15:06], Mike Driscoll ([EMAIL PROTECTED]) wrote:
http://genshi.edgewall.org/
http://www.kid-templating.org/
http://www.cheetahtemplate.org/
http://turbogears.org/

Add the following to that list:

http://jinja.pocoo.org/
http://www.makotemplates.org/

I think Jinja and Mako are currently two of the fastest around.

-- 
Jeroen Ruigrok van der Werven asmodai(-at-)in-nomine.org / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B
If Winter comes, can Spring be far behind..?
--
http://mail.python.org/mailman/listinfo/python-list

PHP + TinyButStrong Python replacement

2008-05-07 Thread pistacchio
hi! i'm a php user and a python programmer. i'd love to use python for 
my server side needs but i can't seem to find what i'm looking for. for 
most of my php work i use mysql and tinyButStrong 
(http://www.tinybutstrong.com) which is a very lightweight template 
engine that offers powerful functionalities. you insert TBS tags in web 
pages like:


div align=center class=title-page [var.x] /div

and it replaces [var.x] with the value of global variable x. it also 
makes blocks (and nested blocks) easy to implement:


p class=text-example2 [blk1;block=begin] [blk1.val]br 
[blk1;block=end] /p


in the previous code it cycles throu all the values of the array blk1.

it does many more things, like htlm escaping, url and js encoding etc, 
conditional displaying etc, but it is not more confusing that inserting 
pieces of code into the HTML (aka: littering the code and kissing 
goodbye to the code/presentation separation). it comes in the form of a 
single file with a single class that you can easily include in the code 
and go.


now, i've searched the net and it seems full of python-based frameworks 
for doing server side scripting and templating, but none that suits my 
needs.


   1. i like writing code and i like control. i mean, open up the 
simplest text editor and write in it. i don't want something that is 
command-line driven or that writes code for me like  
makePagesFromThisDatabase().
   2. i want something very lightweight. i don't want dozen of options, 
pre-made blogging parts ecc. i just need a good non invasive template 
engine and the basic functions for server side scripting, like session 
managing, request parsing, functions to manipulate html code (encodings etc)
   3. i don't want to beg my hosting provider to install the libraries. 
a simple include file should do the work.
   4. object oriented programming is not required (better: i prefer 
plain old procedural programming).


any help? thanks in advance
--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread Mike Driscoll
On May 7, 6:12 am, pistacchio [EMAIL PROTECTED] wrote:
 hi! i'm a php user and a python programmer. i'd love to use python for
 my server side needs but i can't seem to find what i'm looking for. for
 most of my php work i use mysql and tinyButStrong
 (http://www.tinybutstrong.com) which is a very lightweight template
 engine that offers powerful functionalities. you insert TBS tags in web
 pages like:

 div align=center class=title-page [var.x] /div

 and it replaces [var.x] with the value of global variable x. it also
 makes blocks (and nested blocks) easy to implement:

 p class=text-example2 [blk1;block=begin] [blk1.val]br
 [blk1;block=end] /p

 in the previous code it cycles throu all the values of the array blk1.

 it does many more things, like htlm escaping, url and js encoding etc,
 conditional displaying etc, but it is not more confusing that inserting
 pieces of code into the HTML (aka: littering the code and kissing
 goodbye to the code/presentation separation). it comes in the form of a
 single file with a single class that you can easily include in the code
 and go.

 now, i've searched the net and it seems full of python-based frameworks
 for doing server side scripting and templating, but none that suits my
 needs.

     1. i like writing code and i like control. i mean, open up the
 simplest text editor and write in it. i don't want something that is
 command-line driven or that writes code for me like 
 makePagesFromThisDatabase().
     2. i want something very lightweight. i don't want dozen of options,
 pre-made blogging parts ecc. i just need a good non invasive template
 engine and the basic functions for server side scripting, like session
 managing, request parsing, functions to manipulate html code (encodings etc)
     3. i don't want to beg my hosting provider to install the libraries.
 a simple include file should do the work.
     4. object oriented programming is not required (better: i prefer
 plain old procedural programming).

 any help? thanks in advance

Did you look at TurboGears or Django? TG uses Kid in the 1.x series
and Genshi in 2.x (I think) for templating purposes. There's also
Cheetah, one of the more powerful Python templating engines out there.

http://genshi.edgewall.org/
http://www.kid-templating.org/
http://www.cheetahtemplate.org/
http://turbogears.org/

Maybe those links will get you going.

Mike
--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread Diez B. Roggisch
pistacchio wrote:

 Mike Driscoll ha scritto:
 On May 7, 6:12 am, pistacchio [EMAIL PROTECTED] wrote:
 hi! i'm a php user and a python programmer. i'd love to use python for
 my server side needs but i can't seem to find what i'm looking for. for
 most of my php work i use mysql and tinyButStrong
 (http://www.tinybutstrong.com) which is a very lightweight template
 engine that offers powerful functionalities. you insert TBS tags in web
 pages like:

 div align=center class=title-page [var.x] /div

 and it replaces [var.x] with the value of global variable x. it also
 makes blocks (and nested blocks) easy to implement:

 p class=text-example2 [blk1;block=begin] [blk1.val]br
 [blk1;block=end] /p

 in the previous code it cycles throu all the values of the array blk1.

 it does many more things, like htlm escaping, url and js encoding etc,
 conditional displaying etc, but it is not more confusing that inserting
 pieces of code into the HTML (aka: littering the code and kissing
 goodbye to the code/presentation separation). it comes in the form of a
 single file with a single class that you can easily include in the code
 and go.

 now, i've searched the net and it seems full of python-based frameworks
 for doing server side scripting and templating, but none that suits my
 needs.

 1. i like writing code and i like control. i mean, open up the
 simplest text editor and write in it. i don't want something that is
 command-line driven or that writes code for me like 
 makePagesFromThisDatabase().
 2. i want something very lightweight. i don't want dozen of options,
 pre-made blogging parts ecc. i just need a good non invasive template
 engine and the basic functions for server side scripting, like session
 managing, request parsing, functions to manipulate html code (encodings
 etc)
 3. i don't want to beg my hosting provider to install the libraries.
 a simple include file should do the work.
 4. object oriented programming is not required (better: i prefer
 plain old procedural programming).

 any help? thanks in advance
 
 
 hi, thanks for replaying
 
 Did you look at TurboGears or Django? TG uses Kid in the 1.x series
 and Genshi in 2.x (I think) for templating purposes. There's also
 Cheetah, one of the more powerful Python templating engines out there.
 
 
 django is exacly the kind of giant i'm trying to avoid
 
 http://genshi.edgewall.org/
 
 the first lines of the tutorial read:
 First, make sure you have CherryPy 3.0.x installed
 Now, cherrypy is something that is not properly include a file and get
 going!
 http://www.kid-templating.org/
 
 kid seems to have a non-linear approach, but i may give it a try
 
 http://www.cheetahtemplate.org/
 
 cheetah was something that i already considered using. have i to
 install it or can i just import it?

You will need to install any of these. It is part of how python is designed.
Extendability comes with a price-tag.

 I don't know for sure, but I guess the cherrypy-requirement of genshi is
more for the tutorial, not for the templating itself.

Diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread pistacchio

Diez B. Roggisch ha scritto:

pistacchio wrote:


Mike Driscoll ha scritto:

On May 7, 6:12 am, pistacchio [EMAIL PROTECTED] wrote:

hi! i'm a php user and a python programmer. i'd love to use python for
my server side needs but i can't seem to find what i'm looking for. for
most of my php work i use mysql and tinyButStrong
(http://www.tinybutstrong.com) which is a very lightweight template
engine that offers powerful functionalities. you insert TBS tags in web
pages like:

div align=center class=title-page [var.x] /div

and it replaces [var.x] with the value of global variable x. it also
makes blocks (and nested blocks) easy to implement:

p class=text-example2 [blk1;block=begin] [blk1.val]br
[blk1;block=end] /p

in the previous code it cycles throu all the values of the array blk1.

it does many more things, like htlm escaping, url and js encoding etc,
conditional displaying etc, but it is not more confusing that inserting
pieces of code into the HTML (aka: littering the code and kissing
goodbye to the code/presentation separation). it comes in the form of a
single file with a single class that you can easily include in the code
and go.

now, i've searched the net and it seems full of python-based frameworks
for doing server side scripting and templating, but none that suits my
needs.

1. i like writing code and i like control. i mean, open up the
simplest text editor and write in it. i don't want something that is
command-line driven or that writes code for me like 
makePagesFromThisDatabase().
2. i want something very lightweight. i don't want dozen of options,
pre-made blogging parts ecc. i just need a good non invasive template
engine and the basic functions for server side scripting, like session
managing, request parsing, functions to manipulate html code (encodings
etc)
3. i don't want to beg my hosting provider to install the libraries.
a simple include file should do the work.
4. object oriented programming is not required (better: i prefer
plain old procedural programming).

any help? thanks in advance

hi, thanks for replaying


Did you look at TurboGears or Django? TG uses Kid in the 1.x series
and Genshi in 2.x (I think) for templating purposes. There's also
Cheetah, one of the more powerful Python templating engines out there.


django is exacly the kind of giant i'm trying to avoid


http://genshi.edgewall.org/

the first lines of the tutorial read:
First, make sure you have CherryPy 3.0.x installed
Now, cherrypy is something that is not properly include a file and get
going!

http://www.kid-templating.org/

kid seems to have a non-linear approach, but i may give it a try


http://www.cheetahtemplate.org/

cheetah was something that i already considered using. have i to
install it or can i just import it?


You will need to install any of these. It is part of how python is designed.
Extendability comes with a price-tag.



well, the problema is exacly that i'm looking for a python module, not 
for a python library.

most of the tasks i need are just:
1. on the shoulders of the existing standard cgi modules, automate an 
render easier the handling of things such as sessions and requests
2. on the shoulders of the existing standard regex module, have a simple 
but complete templating engine and html-related encoder

--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread pistacchio

Mike Driscoll ha scritto:

On May 7, 6:12 am, pistacchio [EMAIL PROTECTED] wrote:

hi! i'm a php user and a python programmer. i'd love to use python for
my server side needs but i can't seem to find what i'm looking for. for
most of my php work i use mysql and tinyButStrong
(http://www.tinybutstrong.com) which is a very lightweight template
engine that offers powerful functionalities. you insert TBS tags in web
pages like:

div align=center class=title-page [var.x] /div

and it replaces [var.x] with the value of global variable x. it also
makes blocks (and nested blocks) easy to implement:

p class=text-example2 [blk1;block=begin] [blk1.val]br
[blk1;block=end] /p

in the previous code it cycles throu all the values of the array blk1.

it does many more things, like htlm escaping, url and js encoding etc,
conditional displaying etc, but it is not more confusing that inserting
pieces of code into the HTML (aka: littering the code and kissing
goodbye to the code/presentation separation). it comes in the form of a
single file with a single class that you can easily include in the code
and go.

now, i've searched the net and it seems full of python-based frameworks
for doing server side scripting and templating, but none that suits my
needs.

1. i like writing code and i like control. i mean, open up the
simplest text editor and write in it. i don't want something that is
command-line driven or that writes code for me like 
makePagesFromThisDatabase().
2. i want something very lightweight. i don't want dozen of options,
pre-made blogging parts ecc. i just need a good non invasive template
engine and the basic functions for server side scripting, like session
managing, request parsing, functions to manipulate html code (encodings etc)
3. i don't want to beg my hosting provider to install the libraries.
a simple include file should do the work.
4. object oriented programming is not required (better: i prefer
plain old procedural programming).

any help? thanks in advance




hi, thanks for replaying


Did you look at TurboGears or Django? TG uses Kid in the 1.x series
and Genshi in 2.x (I think) for templating purposes. There's also
Cheetah, one of the more powerful Python templating engines out there.



django is exacly the kind of giant i'm trying to avoid


http://genshi.edgewall.org/


the first lines of the tutorial read:
First, make sure you have CherryPy 3.0.x installed
Now, cherrypy is something that is not properly include a file and get 
going!



http://www.kid-templating.org/


kid seems to have a non-linear approach, but i may give it a try


http://www.cheetahtemplate.org/


cheetah was something that i already considered using. have i to 
install it or can i just import it?



http://turbogears.org/


same problem as with django!



Maybe those links will get you going.

Mike

--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread George Sakkis
On May 7, 9:40 am, pistacchio [EMAIL PROTECTED] wrote:

 Diez B. Roggisch ha scritto:



  pistacchio wrote:

  Mike Driscoll ha scritto:
  On May 7, 6:12 am, pistacchio [EMAIL PROTECTED] wrote:
  hi! i'm a php user and a python programmer. i'd love to use python for
  my server side needs but i can't seem to find what i'm looking for. for
  most of my php work i use mysql and tinyButStrong
  (http://www.tinybutstrong.com) which is a very lightweight template
  engine that offers powerful functionalities. you insert TBS tags in web
  pages like:

  div align=center class=title-page [var.x] /div

  and it replaces [var.x] with the value of global variable x. it also
  makes blocks (and nested blocks) easy to implement:

  p class=text-example2 [blk1;block=begin] [blk1.val]br
  [blk1;block=end] /p

  in the previous code it cycles throu all the values of the array blk1.

  it does many more things, like htlm escaping, url and js encoding etc,
  conditional displaying etc, but it is not more confusing that inserting
  pieces of code into the HTML (aka: littering the code and kissing
  goodbye to the code/presentation separation). it comes in the form of a
  single file with a single class that you can easily include in the code
  and go.

  now, i've searched the net and it seems full of python-based frameworks
  for doing server side scripting and templating, but none that suits my
  needs.

      1. i like writing code and i like control. i mean, open up the
  simplest text editor and write in it. i don't want something that is
  command-line driven or that writes code for me like 
  makePagesFromThisDatabase().
      2. i want something very lightweight. i don't want dozen of options,
  pre-made blogging parts ecc. i just need a good non invasive template
  engine and the basic functions for server side scripting, like session
  managing, request parsing, functions to manipulate html code (encodings
  etc)
      3. i don't want to beg my hosting provider to install the libraries.
  a simple include file should do the work.
      4. object oriented programming is not required (better: i prefer
  plain old procedural programming).

  any help? thanks in advance
  hi, thanks for replaying

  Did you look at TurboGears or Django? TG uses Kid in the 1.x series
  and Genshi in 2.x (I think) for templating purposes. There's also
  Cheetah, one of the more powerful Python templating engines out there.

  django is exacly the kind of giant i'm trying to avoid

 http://genshi.edgewall.org/
  the first lines of the tutorial read:
  First, make sure you have CherryPy 3.0.x installed
  Now, cherrypy is something that is not properly include a file and get
  going!
 http://www.kid-templating.org/
  kid seems to have a non-linear approach, but i may give it a try

 http://www.cheetahtemplate.org/
  cheetah was something that i already considered using. have i to
  install it or can i just import it?

  You will need to install any of these. It is part of how python is designed.
  Extendability comes with a price-tag.

 well, the problema is exacly that i'm looking for a python module, not
 for a python library.

What does it matter if it's a single file or a dozen under a package ?
Installation for pure Python packages can be as simple as copying
the package under any directory in your PYTHONPATH.

Check out Mako (http://www.makotemplates.org/), it's pretty powerful
and fast.

George
--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread pistacchio

George Sakkis ha scritto:

On May 7, 9:40 am, pistacchio [EMAIL PROTECTED] wrote:


Diez B. Roggisch ha scritto:




pistacchio wrote:

Mike Driscoll ha scritto:

On May 7, 6:12 am, pistacchio [EMAIL PROTECTED] wrote:

hi! i'm a php user and a python programmer. i'd love to use python for
my server side needs but i can't seem to find what i'm looking for. for
most of my php work i use mysql and tinyButStrong
(http://www.tinybutstrong.com) which is a very lightweight template
engine that offers powerful functionalities. you insert TBS tags in web
pages like:
div align=center class=title-page [var.x] /div
and it replaces [var.x] with the value of global variable x. it also
makes blocks (and nested blocks) easy to implement:
p class=text-example2 [blk1;block=begin] [blk1.val]br
[blk1;block=end] /p
in the previous code it cycles throu all the values of the array blk1.
it does many more things, like htlm escaping, url and js encoding etc,
conditional displaying etc, but it is not more confusing that inserting
pieces of code into the HTML (aka: littering the code and kissing
goodbye to the code/presentation separation). it comes in the form of a
single file with a single class that you can easily include in the code
and go.
now, i've searched the net and it seems full of python-based frameworks
for doing server side scripting and templating, but none that suits my
needs.
1. i like writing code and i like control. i mean, open up the
simplest text editor and write in it. i don't want something that is
command-line driven or that writes code for me like 
makePagesFromThisDatabase().
2. i want something very lightweight. i don't want dozen of options,
pre-made blogging parts ecc. i just need a good non invasive template
engine and the basic functions for server side scripting, like session
managing, request parsing, functions to manipulate html code (encodings
etc)
3. i don't want to beg my hosting provider to install the libraries.
a simple include file should do the work.
4. object oriented programming is not required (better: i prefer
plain old procedural programming).
any help? thanks in advance

hi, thanks for replaying

Did you look at TurboGears or Django? TG uses Kid in the 1.x series
and Genshi in 2.x (I think) for templating purposes. There's also
Cheetah, one of the more powerful Python templating engines out there.

django is exacly the kind of giant i'm trying to avoid

http://genshi.edgewall.org/

the first lines of the tutorial read:
First, make sure you have CherryPy 3.0.x installed
Now, cherrypy is something that is not properly include a file and get
going!

http://www.kid-templating.org/

kid seems to have a non-linear approach, but i may give it a try

http://www.cheetahtemplate.org/

cheetah was something that i already considered using. have i to
install it or can i just import it?

You will need to install any of these. It is part of how python is designed.
Extendability comes with a price-tag.

well, the problema is exacly that i'm looking for a python module, not
for a python library.


What does it matter if it's a single file or a dozen under a package ?
Installation for pure Python packages can be as simple as copying
the package under any directory in your PYTHONPATH.



well, it doesn't matter if it's a single file or a package, but it 
_does_ matter if you have to put them under the path where python is 
installed because, in a typical shared web hosting environment (such the 
one that i use) you don't have access to system directories.



Check out Mako (http://www.makotemplates.org/), it's pretty powerful
and fast.


woudl you suggest mako over cheetah?



George

--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread python
Pistacchio,

Templite
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496702

A light-weight (~40 lines), fully functional, general purpose templating
engine, allowing you to embed python code directly into your text. This
engine is suitable for any templating (not only HTML/XML), and is
minimal (40 lines of code!) and fast (all preprocessing is done in
compile time)

Quote: Very nice. That's just the right amount of markup for embedding
Python into html documents.

Malcolm
--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread Terry Reedy

pistacchio [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

| well, it doesn't matter if it's a single file or a package, but it
| _does_ matter if you have to put them under the path where python is
| installed because, in a typical shared web hosting environment (such the
| one that i use) you don't have access to system directories.

When you do an import, the *first* place the interpreter looks is the 
*current* directory, which usually is the directory containing the main 
file.  That is because the first entry in sys.path is ''.  So put 
'template.py' in the same directory as my_web_code.py.  If necessary, one 
can add an entry to the beginning of sys.path.

No need to touch the site-packages directory.  The only reason to put 
something there is to make modules available to any code in any directory 
without putting a copy in each directory containing python files.

tjr




--
http://mail.python.org/mailman/listinfo/python-list


Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 16:17, pistacchio [EMAIL PROTECTED] wrote:
 George Sakkis ha scritto:
(snip)
  What does it matter if it's a single file or a dozen under a package ?
  Installation for pure Python packages can be as simple as copying
  the package under any directory in your PYTHONPATH.

 well, it doesn't matter if it's a single file or a package, but it
 _does_ matter if you have to put them under the path where python is
 installed because, in a typical shared web hosting environment (such the
 one that i use) you don't have access to system directories.

You *never* have to install anything in the default path - install
your python libs wherever you want, and just make sure this wherever
is in your python path (usually via the PYTHONPATH environment
variable).

  Check out Mako (http://www.makotemplates.org/), it's pretty powerful
  and fast.

 woudl you suggest mako over cheetah?

As far as I'm concerned, I would.  Now if you're looking for a
somewhat barebone MVC framework, you may want to have a look at
web.py.

--
http://mail.python.org/mailman/listinfo/python-list