[web2py] introducing-git-goggles

2011-11-24 Thread António Ramos
http://teebes.com/blog/22/introducing-git-goggles

seems interesting


Re: [web2py] can web2py be used as a static website generator?

2011-11-24 Thread Manuele

On 20/11/2011 23:49, Robert Shaver wrote:
But can I put an HTML file in a directory on the server and reach it 
from the web? That's what I think of as a static web page.
just putting your html file in static folder or subfolder maybe resolve 
your quest?

than you can reach your files with an url like this:

http://localhost:8000/yourapp/static/hello.html

Manuele


[web2py] how to execute a controller from command line

2011-11-24 Thread elffikk
hi,

is it possible to execute a controller from command line without
running a wsgi server?
I want to use that in a long running applications which from time to
time will call different controllers


[web2py] Using Fast CGI

2011-11-24 Thread Web2Py Freak
Dear ALL,

I want to use a normal python host and i want to know how can i use
fast CGI for this  ??


Re: [web2py] Using Fast CGI

2011-11-24 Thread Vasile Ermicioi
http://web2py.com/book/default/chapter/11

and what hosting do you use now?


[web2py] Re: Using Fast CGI

2011-11-24 Thread Web2Py Freak
i want to use arvix and i picked python as my language   , now what i
want to know is what would i upload  to the host  the full framework
or my website , i dont know where to start


Re: [web2py] Re: github hg repo

2011-11-24 Thread Bruno Rocha
I was an  hg lover, for a long time I resisted to use git.

But now, I am discovering git  github and I am really enjoying to work
with git.

May be because I like more github than bitbucket or gcode.


[web2py] Re: introducing-git-goggles

2011-11-24 Thread szimszon
Nice


[web2py] Re: ValueError: need more than 1 value to unpack

2011-11-24 Thread Rahul
Hi Massimo,
now contains -
import datetime; now = datetime.datetime.now() # For date time

Thanks, Rahul D

On Nov 22, 7:22 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
         form.vars.updated_on= now

 what's now?

         form.vars.posted_by = Rahul

 posted_by must be an id.
 On Nov 22, 3:21 am, Rahul rahul.dhak...@gmail.com wrote:







  What's inside now?
  Inside now contains this -
  import datetime; now = datetime.datetime.now() # For date time

  Vinicius, I am sorry about the messed up traceback - Never noticed
  that. simply copy-pasted the same. will take care in future (for now
  its pasted below again)

  But I don't understand why the code isnt working when I am serializing
  this in view? It seems to work on the db and even the below code works
  fine -

  def before_submit_of_update(form):
          form.vars.updated_on= now
          form.vars.posted_by = Rahul

  here now works fine. what is the problem when I am serializing it?

  Traceback (most recent call last):  [Reformatted ]
  File D:\WEB2PY\web2py\gluon\restricted.py, line 194, in
  restricted    exec ccode in environment  File D:/WEB2PY/web2py/
  applications/Link_IT/controllers/default.py, line 276, in module
  File D:\WEB2PY\web2py\gluon\globals.py, line 149, in lambda
  self._caller = lambda f: f()  File D:/WEB2PY/web2py/applications/
  Link_IT/controllers/default.py, line 58, in index    return
  dict(form=form, list_updates=db(db.updates).select())
  File D:\WEB2PY\web2py\gluon\dal.py, line 5697, in select    return
  self.db._adapter.select(self.query,fields,attributes)
  File D:\WEB2PY\web2py\gluon\dal.py, line 1233, in select    rows =
  response(sql)
  File D:\WEB2PY\web2py\gluon\dal.py, line 1223, in response
  self.execute(sql)
  File D:\WEB2PY\web2py\gluon\dal.py, line 1309, in execute    return
  self.log_execute(*a, **b)  File D:\WEB2PY\web2py\gluon\dal.py, line
  1304, in log_execute    ret = self.cursor.execute(*a,**b)
  File C:\Python27\lib\sqlite3\dbapi2.py, line 66, in
  convert_timestamp    datepart, timepart = val.split( )ValueError:
  need more than 1 value to unpack

  I am working on other options for splitting etc.

  Thanks, Rahul D
  (www.flockbird.com) - web2py powered

  Regards, Rahul
  (www.flockbird.com-web2py powered)

  On Nov 21, 7:14 pm, Vinicius Assef vinicius...@gmail.com wrote:

   Rahul, this is a str.split() error and it happens when there are less
   pieces than str.split() expects.

   An example:

fullname = 'John Smith'
(first_name, last_name) = fullname.split( )
print 'first:', first_name, '- last:', last_name
   John - Smith
fullname = 'John'
(first_name, last_name) = fullname.split( )

   Traceback (most recent call last):
     File pyshell#6, line 1, in module
       (first_name, last_name) = fullname.split( )
   ValueError: need more than 1 value to unpack

   There weren't 2 parts in fullname. That's why the error occured.

   Back to your problem, the same is happening with your updated_on
   field. I'd make default=request.now on it.

   BTW, try organize the traceback. It helps people helping you.

   --
   Vinicius Assef.

   On Mon, Nov 21, 2011 at 10:48 AM, Rahul rahul.dhak...@gmail.com wrote:
Hi All,
   Is there a solution for below traceback I posted (I am on 1.99.2,
win7, firefox,ie9). Tried search for a solution in below thread .. no
help ...

   http://groups.google.com/group/web2py/browse_thread/thread/fc4a30879f...

Traceback
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.
Traceback (most recent call last):  File D:\WEB2PY\web2py\gluon
\restricted.py, line 194, in restricted    exec ccode in environment
File D:/WEB2PY/web2py/applications/Link_IT/controllers/default.py,
line 276, in module  File D:\WEB2PY\web2py\gluon\globals.py, line
149, in lambda    self._caller = lambda f: f()  File D:/WEB2PY/
web2py/applications/Link_IT/controllers/default.py, line 58, in
index    return dict(form=form, list_updates=db(db.updates).select())
File D:\WEB2PY\web2py\gluon\dal.py, line 5697, in select    return
self.db._adapter.select(self.query,fields,attributes)  File D:\WEB2PY
\web2py\gluon\dal.py, line 1233, in select    rows = response(sql)
File D:\WEB2PY\web2py\gluon\dal.py, line 1223, in response
self.execute(sql)  File D:\WEB2PY\web2py\gluon\dal.py, line 1309, in
execute    return self.log_execute(*a, **b)  File D:\WEB2PY\web2py
\gluon\dal.py, line 1304, in log_execute    ret =
self.cursor.execute(*a,**b)  File C:\Python27\lib\sqlite3\dbapi2.py,
line 66, in convert_timestamp    datepart, timepart = val.split(
)ValueError: need more than 1 value to unpack

here is my controller (default.py) --

def index():
 return dict( list_updates=db(db.updates).select())

here is the view (index.html) -

{{right_sidebar_enabled=False}}
{{extend 'layout.html'}}
{{=list_updates}}

my model 

[web2py] Re: SQLFORM upload type and long file+path names

2011-11-24 Thread Anthony
On Thursday, November 24, 2011 12:06:24 AM UTC-5, Massimo Di Pierro wrote:

  1) Is there an easy way to overload the default behavior of the
  SQLFORM so it stores the filename in the database, instead of encoding
  it in the renamed-file? I see the Field class has a custom_store/
  retrieve variable, could I just duplicate the default DAL store/
  retrieve functions and add my extra file name logic? Or is there a
  better way?

 One thing you can do it is

 Field('name','upload',length=260)

 it will truncate the generated filename to 260.

Note, I think using the 'length' arg in this way requires trunk. In the 
current stable version, it automatically limits the filename to 200 
characters (plus extension). If you set length to less than 200, I'm not 
sure what happens.

In trunk, length defaults to 512, but if you set it lower, it will limit 
the entire filename (including extension) to that length. Note, the 
filename is of the form

[table].[field].[16-char uuid fragment].[b16encoded original 
filename].[extension]

If that ends up longer than 'length', it gets truncated from the end 
(though the extension is not truncated). So, depending on the table and 
field names, you need about 40 characters even without encoding the 
original filename at all.

Also, note that the 'length' argument applies to the filename only -- it 
does not include the full path length, so you have to account for that 
separately when setting the length (maybe we should have it apply to the 
full path length when the file is being stored on the filesystem).

Anthony



[web2py] Access remote oracle database

2011-11-24 Thread Humberto
Hi, I just started using web2py and I'm don't know how to connect to
my remote oracle database.

According with the chapter 6 of the official book the url should be
the following:

oracle://username/password@test

There are no parameters for the server ip address in the example, then
I tried this:

oracle://myusername/mypassword@server_ip_address/database_name

and

oracle://myusername/mypassword@server_ip_address:1521/database_name

None of them worked.

What I need to do in order to access my oracle database remotely?


Re: [web2py] Re: github hg repo

2011-11-24 Thread rif
I really tried to switch from hg to git (several times) but did not 
find sufficient reasons to stick with it.

[web2py] new to web2py/python

2011-11-24 Thread chandrakant kumar
Hello

I'm new to web2py/python, web development in general. can you suggest me
the appropriate learning path. I've used django for couple of months.

regards


Re: [web2py] new to web2py/python

2011-11-24 Thread Richard Vézina
Read the book... Also there is a breif introduction to python in the first
or second chapter...

Richard

On Thu, Nov 24, 2011 at 11:37 AM, chandrakant kumar
k.03chan...@gmail.comwrote:

 Hello

 I'm new to web2py/python, web development in general. can you suggest me
 the appropriate learning path. I've used django for couple of months.

 regards



Re: [web2py] new to web2py/python

2011-11-24 Thread António Ramos
Dont be afraid to ask
People here tend to be very helpfull with newbies like you and me.
Dont know why  :)




2011/11/24 Richard Vézina ml.richard.vez...@gmail.com

 Read the book... Also there is a breif introduction to python in the first
 or second chapter...

 Richard


 On Thu, Nov 24, 2011 at 11:37 AM, chandrakant kumar k.03chan...@gmail.com
  wrote:

 Hello

 I'm new to web2py/python, web development in general. can you suggest me
 the appropriate learning path. I've used django for couple of months.

 regards





[web2py] About transactions

2011-11-24 Thread Jose
Hello

as I make the following actions run within the same transaction

form = SQLFORM(my_table)

if form.accepts(request.vars, session):
id = int(form.vars.id)
doc = my_table[id]
doc.update_record(state=1)
other_table.insert(documento=doc, ...)
redirect(my_url)
elif form.errors:
response.flash = 'errors'

return dict(form=form)

I need to submit, update_record and insert running on the same
transaction.

Best Regards
Jose


[web2py] Re: how to execute a controller from command line

2011-11-24 Thread Massimo Di Pierro
You can do

python web2py.py -S welcome/default/index -M -N

but it will not call the view

On Nov 24, 5:13 am, elffikk elff...@gmail.com wrote:
 hi,

 is it possible to execute a controller from command line without
 running a wsgi server?
 I want to use that in a long running applications which from time to
 time will call different controllers


[web2py] Re: how to execute a controller from command line

2011-11-24 Thread Massimo Di Pierro
If you want to call the view just do

wget http://127.0.0.1:8000/welcome/default/index

On Nov 24, 12:26 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 You can do

 python web2py.py -S welcome/default/index -M -N

 but it will not call the view

 On Nov 24, 5:13 am, elffikk elff...@gmail.com wrote:







  hi,

  is it possible to execute a controller from command line without
  running a wsgi server?
  I want to use that in a long running applications which from time to
  time will call different controllers


[web2py] Re: Access remote oracle database

2011-11-24 Thread Massimo Di Pierro
I think

oracle://myusername:mypassword@server_ip_address:1521/database_name

On Nov 24, 8:43 am, Humberto humbfd...@gmail.com wrote:
 Hi, I just started using web2py and I'm don't know how to connect to
 my remote oracle database.

 According with the chapter 6 of the official book the url should be
 the following:

 oracle://username/password@test

 There are no parameters for the server ip address in the example, then
 I tried this:

 oracle://myusername/mypassword@server_ip_address/database_name

 and

 oracle://myusername/mypassword@server_ip_address:1521/database_name

 None of them worked.

 What I need to do in order to access my oracle database remotely?


[web2py] Re: About transactions

2011-11-24 Thread Massimo Di Pierro
They run in the same transactions by default.

On Nov 24, 10:58 am, Jose jjac...@gmail.com wrote:
 Hello

 as I make the following actions run within the same transaction

     form = SQLFORM(my_table)

     if form.accepts(request.vars, session):
         id = int(form.vars.id)
         doc = my_table[id]
         doc.update_record(state=1)
         other_table.insert(documento=doc, ...)
         redirect(my_url)
     elif form.errors:
         response.flash = 'errors'

     return dict(form=form)

 I need to submit, update_record and insert running on the same
 transaction.

 Best Regards
 Jose


[web2py] My ideas/proposals for the CMS

2011-11-24 Thread ~redShadow~
It's been some time since I started thinking about which structure
should be given to the web2py-based CMS.

So far, I came out with some experiments and tons of
brainstorming-level documentation of how I thing stuff should be made.

So, here it is some stuff:

Project homepage:
http://w2cms.com/

Source code on GitHub:
https://github.com/rshk/web2cms/

Documentation:
http://w2cms.com/doc/_build/html/

The project status is not even considerable an alpha, what I did is
more experiment-level, but I started defining a structure as I think it
should be.

A quick overview of planned features:

* Different kind of contents (page, article, ...), referred as node,
managed by the same code, but with different fields/views/behavior. This
is very similar to drupal content management, for who is familiar with
it.
* User-defined fields associated to content types. Unlike drupal,
configuration should be placed (also?) in configuration files, to keep
structure and content well separated
* The main layout is composed of different regions, in which some
blocks, containing either static or dynamic content may be placed.
* Comments and stuff, as components (with ajax loading, etc.)
* Categories/tags/.. managed by assigning tags to stuff (not only to
content, possibly to users or other entities). Tags are categorized in
vocabularies that define the tag behavior / limitations, and can be
organized in trees.
* Relationships. A lot of stuff can be defined by defining
relationships between entities, such as parent for a tree
organization, like for a facebook-like liking of things, vote with a
'3' value to implement a fivestar content rating, etc.
* Everything is translatable. I see how in other software, such as
Drupal, translation of content can become a pain if it's not directly
supported by the core, so I created a way to handle translations of
pretty much everything with parallel ``t9n_*`` tables.
* Per-domain configuration selection. the database connection URI and
other settings may be defined per-domain (autodiscovery? through
environment vars? ...?), in order to manage several websites on one
web2py installation.

Feel free to clone and test the CMS, everything should work out of the
box using SQLite; just keep in mind that there is very few to see at the
moment (content creation, listing and display are the only things
working as I write).

Any feedback / suggestion / proposal is greatly appreciated!

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  Software is like sex: it's better when it's free!
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: Access remote oracle database

2011-11-24 Thread Humberto
web2py already comes with native oracle support? I installed pyodbc
and cx_oracle, but I still can't connect to my remote oracle database.

I tested a connection with postgres (I needed to install psycopg2) and
it's working fine.

Ps. My OS is Windows 7 x64.
Ps2. I tried running the web2py binary and from the source.


Re: [web2py] Re: how to execute a controller from command line

2011-11-24 Thread Vasile Ermicioi
python web2py.py -S welcome/default/index -M -N

is what I was looking for,
but I need the ability to execute it from python and want to pass arguments
and vars
would like to do that without subprocesses (like os.system or others)

something like

import gluon.main
gluon.main.wsgi.exec(app,controller, args, vars)


Re: [web2py] My ideas/proposals for the CMS

2011-11-24 Thread Bruno Rocha
Does it works on Google App Engine?

I will take a look and test today!

Thanks for sharing!

On Thu, Nov 24, 2011 at 4:34 PM, ~redShadow~ redsha...@hackzine.org wrote:

 It's been some time since I started thinking about which structure
 should be given to the web2py-based CMS.

 So far, I came out with some experiments and tons of
 brainstorming-level documentation of how I thing stuff should be made.

 So, here it is some stuff:

 Project homepage:
 http://w2cms.com/

 Source code on GitHub:
 https://github.com/rshk/web2cms/

 Documentation:
 http://w2cms.com/doc/_build/html/

 The project status is not even considerable an alpha, what I did is
 more experiment-level, but I started defining a structure as I think it
 should be.

 A quick overview of planned features:

 * Different kind of contents (page, article, ...), referred as node,
 managed by the same code, but with different fields/views/behavior. This
 is very similar to drupal content management, for who is familiar with
 it.
 * User-defined fields associated to content types. Unlike drupal,
 configuration should be placed (also?) in configuration files, to keep
 structure and content well separated
 * The main layout is composed of different regions, in which some
 blocks, containing either static or dynamic content may be placed.
 * Comments and stuff, as components (with ajax loading, etc.)
 * Categories/tags/.. managed by assigning tags to stuff (not only to
 content, possibly to users or other entities). Tags are categorized in
 vocabularies that define the tag behavior / limitations, and can be
 organized in trees.
 * Relationships. A lot of stuff can be defined by defining
 relationships between entities, such as parent for a tree
 organization, like for a facebook-like liking of things, vote with a
 '3' value to implement a fivestar content rating, etc.
 * Everything is translatable. I see how in other software, such as
 Drupal, translation of content can become a pain if it's not directly
 supported by the core, so I created a way to handle translations of
 pretty much everything with parallel ``t9n_*`` tables.
 * Per-domain configuration selection. the database connection URI and
 other settings may be defined per-domain (autodiscovery? through
 environment vars? ...?), in order to manage several websites on one
 web2py installation.

 Feel free to clone and test the CMS, everything should work out of the
 box using SQLite; just keep in mind that there is very few to see at the
 moment (content creation, listing and display are the only things
 working as I write).

 Any feedback / suggestion / proposal is greatly appreciated!

 --
 Samuele ~redShadow~ Santi
 
 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933
 
 /me recommends:
Squadra Informatica - http://www.squadrainformatica.com
 
  - Proud ThinkPad T-Series owner
  - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user
 
  Software is like sex: it's better when it's free!
  -- Linus Torvalds




-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] My ideas/proposals for the CMS

2011-11-24 Thread ~redShadow~
On Thu, 2011-11-24 at 16:56 -0200, Bruno Rocha wrote:
 Does it works on Google App Engine?
 
 I will take a look and test today!
 
 Thanks for sharing!

Thanks for testing! -- That's why I shared :)
(Long Live Open Source) 
-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  Software is like sex: it's better when it's free!
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: My ideas/proposals for the CMS

2011-11-24 Thread Gour
On Thu, 24 Nov 2011 19:34:52 +0100
~redShadow~ redsha...@hackzine.org wrote:

 * Different kind of contents (page, article, ...), referred as node,
 managed by the same code, but with different fields/views/behavior.
 This is very similar to drupal content management, for who is
 familiar with it.
 * User-defined fields associated to content types. Unlike drupal,
 configuration should be placed (also?) in configuration files, to keep
 structure and content well separated
 * The main layout is composed of different regions, in which some
 blocks, containing either static or dynamic content may be placed.

I'm not familiar with Drupal, but very much like Concrete5
(concrete5.org) where it is extremely easy to convert HTML/CSS/JS theme
into Concrete5 one. Moreover, different page types just define areas on
the page where user can then freely put different type of content via
blocks.

 * Comments and stuff, as components (with ajax loading, etc.)
 * Categories/tags/.. managed by assigning tags to stuff (not only to
 content, possibly to users or other entities). Tags are categorized in
 vocabularies that define the tag behavior / limitations, and can be
 organized in trees.

Blog, comments, categories and tags are e.g. in Concrete5 realized via
add-ons or different 'Blog plugins' and does not belong to the core.

 * Everything is translatable. I see how in other software, such as
 Drupal, translation of content can become a pain if it's not directly
 supported by the core, so I created a way to handle translations of
 pretty much everything with parallel ``t9n_*`` tables.

Concrete5 uses gettext, *.po/mo files and every translatable function is
prefixed with t().

Finally, Concrete5 is CMS written on top of MVS framework which enables
developers to easily develop different add-on like blogs, news,
ecommerce modules etc., so I believe that web2py CMS should take
advantage of its framework and provide API for developers so that it can
be easily enhanced.

Please, take a look at Concrete5.


Sincerely,
Gour

-- 
You have a right to perform your prescribed duty, 
but you are not entitled to the fruits of action. 
Never consider yourself the cause of the results 
of your activities, and never be attached to not doing your duty.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: About transactions

2011-11-24 Thread Jose


On 24 nov, 15:31, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 They run in the same transactions by default.

Nop!
Please see the following example


model:

tb_1 = db.define_table('t1',
Field('field1'),
Field('field2', 'integer')
)

tb_2 = db.define_table('t2',
Field('field1'),
Field('field2', 'integer')
)

controller:

def test():
form = SQLFORM(tb_1)
if form.accepts(request.vars, session):
try:
tb_2.insert(field1='test', field2='1dfdfh') #field2 is
integer, must be a mistake
redirect(URL('test'))
except:
redirect(URL('error'))
elif form.errors:
response.flash = 'errors'
return dict(form=form)

def error():
return dict()


despite the error, the record is inserted in tb_1. And I believe so,
because first submit occurs. So I asked how to include submit and
subsequent actions in a tranasaccion.

Jose


[web2py] How to include T from gluon in custom module

2011-11-24 Thread monotasker
I'm writing a plugin and (as recommended) putting my plugin classes in the 
modules folder. I'm using from gluon import * to get gluon classes in the 
module file, but I'm still getting an error message about translation 
strings: global name 'T' is not defined. Do I need to import T from a 
specific gluon file?


Re: [web2py] Re: My ideas/proposals for the CMS

2011-11-24 Thread ~redShadow~
On Thu, 2011-11-24 at 20:05 +0100, Gour wrote: 
 On Thu, 24 Nov 2011 19:34:52 +0100
 ~redShadow~ redsha...@hackzine.org wrote:
 
  * Different kind of contents (page, article, ...), referred as node,
  managed by the same code, but with different fields/views/behavior.
  This is very similar to drupal content management, for who is
  familiar with it.
  * User-defined fields associated to content types. Unlike drupal,
  configuration should be placed (also?) in configuration files, to keep
  structure and content well separated
  * The main layout is composed of different regions, in which some
  blocks, containing either static or dynamic content may be placed.
 
 I'm not familiar with Drupal, but very much like Concrete5
 (concrete5.org) where it is extremely easy to convert HTML/CSS/JS theme
 into Concrete5 one. Moreover, different page types just define areas on
 the page where user can then freely put different type of content via
 blocks.

For page types, you mean the equivalent of layout.html?
That's exactly what drupal does and I'm doing here; plus I think that
columns population is more view-specific than controller-specific; for
example the same controller would return the same bare list of posts
either for the last posts html view and the rss feed view, but the
html one will also populate sidebars with blocks, footer with copyright
message, etc.

  * Comments and stuff, as components (with ajax loading, etc.)
  * Categories/tags/.. managed by assigning tags to stuff (not only to
  content, possibly to users or other entities). Tags are categorized in
  vocabularies that define the tag behavior / limitations, and can be
  organized in trees.
 
 Blog, comments, categories and tags are e.g. in Concrete5 realized via
 add-ons or different 'Blog plugins' and does not belong to the core.

The idea is to have the core (but possibly also 'extension modules')
define several entities that can be used to design the whole
structure. So many stuff will probably go into core modules, just to
let them be eventually unplugged and/or replaced by contributed ones.
But since this is the most relevant part, I'm working on this :)

  * Everything is translatable. I see how in other software, such as
  Drupal, translation of content can become a pain if it's not directly
  supported by the core, so I created a way to handle translations of
  pretty much everything with parallel ``t9n_*`` tables.
 
 Concrete5 uses gettext, *.po/mo files and every translatable function is
 prefixed with t().

Yep. I think that one big error here is to mix up t()-ranslatable
strings with multi-language content.

The scope of the ``t()`` function (that exists in Drupal too, using *.po
files, imported into database for performance; also called ``T()`` in
web2py) is to translate *short* strings, mostly hard-coded, and used in
the interface.

For the actual *contents* (pages, etc.) it's important that translations
are kept separated (as possibly the translation source can be updated
after translation, etc.), but, for example, the Drupal core doesn't
handle this directly, so contributed modules implementing this have to
hack it into core logic, but this won't always work smoothly as
expected. 

 Finally, Concrete5 is CMS written on top of MVS framework which enables
 developers to easily develop different add-on like blogs, news,
 ecommerce modules etc., so I believe that web2py CMS should take
 advantage of its framework and provide API for developers so that it can
 be easily enhanced.

Drupal is not *based on* a framework, it *is* a framework + some core
modules defining the basic cms behavior + contributed modules extending
functionality.

I'm working on the add-ons/modules management thing too; maybe I
recently figured out the best way to handle this, but I'm not already
sure it is the right way to do that, so, more info about it is coming
soon.

 Please, take a look at Concrete5.

I'll have a look at it for knowledge, although for what I understood, it
isn't very distant from Drupal and what is my idea of CMS.

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  Software is like sex: it's better when it's free!
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


Re: [web2py] How to include T from gluon in custom module

2011-11-24 Thread Bruno Rocha
in module

from gluon import current

class MyClass(object):
def __init__(self):
self.T = current.T


# important only assign current objects inside instance methods. Never do
it as class attributes or on module top level.

On Thu, Nov 24, 2011 at 5:31 PM, monotasker scotti...@gmail.com wrote:

 I'm writing a plugin and (as recommended) putting my plugin classes in the
 modules folder. I'm using from gluon import * to get gluon classes in the
 module file, but I'm still getting an error message about translation
 strings: global name 'T' is not defined. Do I need to import T from a
 specific gluon file?




-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] How to include T from gluon in custom module

2011-11-24 Thread monotasker
Thanks again Bruno.


[web2py] Re: web2py solution for debbuging with FirePHP/Firebug

2011-11-24 Thread faultyzebra
Hello,

The file is not available at this link http://www.box.net/shared/dtm0dhgze9
 anymore. 
Can you re-upload it or make it available in any other form? 

Your gesture will be highly appreciated.
Regards,
FZ


[web2py]

2011-11-24 Thread massimo.dipie...@gmail.com
Who is user web2py on github?From my Android phone on T-Mobile. The first nationwide 4G network.

Re: [web2py] Re: orderby='random' on Google App Engine

2011-11-24 Thread Bruno Rocha
Isn't random sort suported in GAE ?


* rows = db(query).select().sort(lambda row: random.random())
 File
 /base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py, line
 5789, in select
 return self.db._adapter.select(self.query,fields,attributes)
 File
 /base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py, line
 3410, in select
 (items, tablename, fields) = self.select_raw(query,fields,attributes)
 File
 /base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py, line
 3367, in select_raw
 filters = self.expand(query)
 File
 /base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py, line
 3249, in expand
 return expression.op(expression.first, expression.second)
 File
 /base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py, line
 3263, in AND
 a = self.expand(first)
 File
 /base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py, line
 3249, in expand
 return expression.op(expression.first, expression.second)
 File
 /base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py, line
 3109, in OR
 def OR(self,first,second): raise SyntaxError, Not supported
 SyntaxError: Not supported *

*
*
*--
*
*
*
*Bruno Rocha*
*[http://rochacbruno.com.br]*


[web2py] Re: About transactions

2011-11-24 Thread Anthony
But what about your first example, without the try...except? Are you saying 
that if the other_table.insert() fails, the doc.update_record() still 
succeeds in committing? I don't think that should be the case. If there's 
an uncaught exception before the response is returned, web2py should roll 
back any open transactions.

Anthony

On Thursday, November 24, 2011 2:11:19 PM UTC-5, Jose wrote:

 On 24 nov, 15:31, Massimo Di Pierro massimo@gmail.com
 wrote:
  They run in the same transactions by default.

 Nop!
 Please see the following example


 model:

 tb_1 = db.define_table('t1',
 Field('field1'),
 Field('field2', 'integer')
 )

 tb_2 = db.define_table('t2',
 Field('field1'),
 Field('field2', 'integer')
 )

 controller:

 def test():
 form = SQLFORM(tb_1)
 if form.accepts(request.vars, session):
 try:
 tb_2.insert(field1='test', field2='1dfdfh') #field2 is
 integer, must be a mistake
 redirect(URL('test'))
 except:
 redirect(URL('error'))
 elif form.errors:
 response.flash = 'errors'
 return dict(form=form)

 def error():
 return dict()


 despite the error, the record is inserted in tb_1. And I believe so,
 because first submit occurs. So I asked how to include submit and
 subsequent actions in a tranasaccion.

 Jose



Re: [web2py] Re: how to execute a controller from command line

2011-11-24 Thread Anthony
Maybe 
exec_environment: 
http://web2py.com/book/default/chapter/04#Execution-Environment

On Thursday, November 24, 2011 1:43:11 PM UTC-5, elffikk wrote:

 python web2py.py -S welcome/default/index -M -N

 is what I was looking for, 
 but I need the ability to execute it from python and want to pass 
 arguments and vars 
 would like to do that without subprocesses (like os.system or others)

 something like

 import gluon.main
 gluon.main.wsgi.exec(app,controller, args, vars)

  

[web2py] Re: About transactions

2011-11-24 Thread Anthony
Note, in your try...except example, you could do:

except:
db.rollback()
redirect(URL('error'))

See http://web2py.com/book/default/chapter/06#commit-and-rollback.

Anthony

On Thursday, November 24, 2011 5:40:39 PM UTC-5, Anthony wrote:

 But what about your first example, without the try...except? Are you 
 saying that if the other_table.insert() fails, the doc.update_record() 
 still succeeds in committing? I don't think that should be the case. If 
 there's an uncaught exception before the response is returned, web2py 
 should roll back any open transactions.

 Anthony

 On Thursday, November 24, 2011 2:11:19 PM UTC-5, Jose wrote:

 On 24 nov, 15:31, Massimo Di Pierro massi...@gmail.com
 wrote:
  They run in the same transactions by default.

 Nop!
 Please see the following example


 model:

 tb_1 = db.define_table('t1',
 Field('field1'),
 Field('field2', 'integer')
 )

 tb_2 = db.define_table('t2',
 Field('field1'),
 Field('field2', 'integer')
 )

 controller:

 def test():
 form = SQLFORM(tb_1)
 if form.accepts(request.vars, session):
 try:
 tb_2.insert(field1='test', field2='1dfdfh') #field2 is
 integer, must be a mistake
 redirect(URL('test'))
 except:
 redirect(URL('error'))
 elif form.errors:
 response.flash = 'errors'
 return dict(form=form)

 def error():
 return dict()


 despite the error, the record is inserted in tb_1. And I believe so,
 because first submit occurs. So I asked how to include submit and
 subsequent actions in a tranasaccion.

 Jose



[web2py] Re: table inheritance and defined requires

2011-11-24 Thread GOwin

Nik, declare your validators before you clone your model.

I've encountered this issue before and the problem was because I wasn't* 
*declaring 
validators of the master table *BEFORE* I define the new gholas (i.e. 
clones) table. When I re-located the offending .requires immediately 
after the master table, inheritance worked as expected. 

Massimo, maybe it's worth a mention in the new book version, considering 
that its coding convention: define models first,  validators later. It 
might save a few hours worth of head scratching and a lifetime of hair 
loss. :D

Here's a proposed entry: 

Table inheritance may not behave as expected if attributes or validators 
are left undefined before passing them to the *define_table*. If the cloned 
fields are expected to behave like the original, ensure attributes are 
declared prior to using them for defining subsequent models.

... 

doesn't work: as expected 
db.define_table('t_master', Field('f1'), Field('f2'))
db.define_table('t_ghola', db.t_master, Field('owner', db.auth_user))
db.t_master.f1.requires=IS_NOT_EMPTY() # defined before clone creation; 
validator not inherited
db.t_master.f1.requires == db.t_ghola.f1.requires
*False*
 inheritance works
db.define_table('t_master', Field('f1'), Field('f2'))
db.t_master.f1.requires=IS_NOT_EMPTY() #validator defined before clone 
table creation
db.define_table('t_ghola', db.t_master, Field('owner', db.auth_user))
db.t_master.f1.requires == db.t_ghola.f1.requires
*True*

*
*
P.S. Found a typo in the book,  Self-Reference and Aliases section, in case 
it hasn't been corrected yet. *Subtle*, misspelled as subtile: The 
difference is *subtile*, and there is ...

Best,


[web2py] Re: Access remote oracle database

2011-11-24 Thread Massimo Di Pierro

Web2py supports oracle. Requires cxoracle and rinning from source.
What problem do you experience?


On Nov 24, 12:42 pm, Humberto humbfd...@gmail.com wrote:
 web2py already comes with native oracle support? I installed pyodbc
 and cx_oracle, but I still can't connect to my remote oracle database.

 I tested a connection with postgres (I needed to install psycopg2) and
 it's working fine.

 Ps. My OS is Windows 7 x64.
 Ps2. I tried running the web2py binary and from the source.


[web2py] Re: About transactions

2011-11-24 Thread Massimo Di Pierro
Anthony is right
 if you catch the exception yourself web2py stll commits because does
not detect failure. If catch the exception and want to rollback you
have to be explicit. Still. It is in a transaction.

On Nov 24, 5:11 pm, Anthony abasta...@gmail.com wrote:
 Note, in your try...except example, you could do:

     except:
         db.rollback()
         redirect(URL('error'))

 Seehttp://web2py.com/book/default/chapter/06#commit-and-rollback.

 Anthony



 On Thursday, November 24, 2011 5:40:39 PM UTC-5, Anthony wrote:

  But what about your first example, without the try...except? Are you
  saying that if the other_table.insert() fails, the doc.update_record()
  still succeeds in committing? I don't think that should be the case. If
  there's an uncaught exception before the response is returned, web2py
  should roll back any open transactions.

  Anthony

  On Thursday, November 24, 2011 2:11:19 PM UTC-5, Jose wrote:

  On 24 nov, 15:31, Massimo Di Pierro massi...@gmail.com
  wrote:
   They run in the same transactions by default.

  Nop!
  Please see the following example

  model:

  tb_1 = db.define_table('t1',
      Field('field1'),
      Field('field2', 'integer')
  )

  tb_2 = db.define_table('t2',
      Field('field1'),
      Field('field2', 'integer')
  )

  controller:

  def test():
      form = SQLFORM(tb_1)
      if form.accepts(request.vars, session):
          try:
              tb_2.insert(field1='test', field2='1dfdfh') #field2 is
  integer, must be a mistake
              redirect(URL('test'))
          except:
              redirect(URL('error'))
      elif form.errors:
          response.flash = 'errors'
      return dict(form=form)

  def error():
      return dict()

  despite the error, the record is inserted in tb_1. And I believe so,
  because first submit occurs. So I asked how to include submit and
  subsequent actions in a tranasaccion.

  Jose


Re: [web2py] Re: how to execute a controller from command line

2011-11-24 Thread Vasile Ermicioi
yep, that it is, I should read again the book :)

thank you Massimo,
thank you Anthony


Re: [web2py] Ajax and table rows.

2011-11-24 Thread Nik Go
Cliff, you alluded that this doesn't work, but it's actually a valid
signature and should work:

IS_IN_DB(db(db.categories.parent_table==request.args(0)),'categories.id','
categories.name')

just as valid as the following signatures:
IS_IN_DB(db(db.categories.parent_table==request.args(0)), categories.id,
db.categories._format) #uses the default format of the source table
IS_IN_DB(db(db.categories.parent_table==request.args(0)), categories.id,
%(name)s)
IS_IN_DB(db(db.categories.parent_table==request.args(0)), db.categories.id,
%(name)s)

The OP didn't state what the error was, but there's a typo in his
validator: c ategories.name when it should've been just categories.name.
 Could that be the problem?


On Wednesday, November 23, 2011, Cliff wrote:

 signature from book:
 IS_IN_DB(db, 'person.id', '%(name)s', zero=T('choose one'))

 can also be:
 IS_IN_DB(db(query), 'person.id', '%(name)s', zero=T('choose one'))

 You have:
 IS_IN_DB(db(db.categories.parent_table==request.args(0)),'categories.id
 ','c
 ategories.name')

 Should be:
 IS_IN_DB(db(db.categories.parent_table==request.args(0)),'categories.id
 ','%
 (name)s')




 On Nov 21, 10:17 am, tsvim ttm...@gmail.com javascript:; wrote:
  Ok, now that this works seems I'm still in trouble.
  The page I'm loading is one that has a table that I'm trying to make
  clickable and a form to enter more data.
  Here is the controller:
 
  @auth.requires_login()
  def budget():
  db.expense.parent_table.default = request.args(0)
  db.expense.category.requires =
  IS_IN_DB(db(db.categories.parent_table==request.args(0)),'categories.id','c
 ategories.name')
  form = crud.create(db.expense)
  expenses = db(db.expense.parent_table==request.args(0)).select()
  return dict(user=auth.user.first_name, expenses=expenses, form=form)
 
  def edit_expense():
  return repr(request.vars.id)
 
  My view:
  table
tr
  thDate and Time/th
  thTitle/th
  thCategory/th
  thAmount/th
  thSource/th
/tr
 
{{ for expense in expenses: }}
 
tr class=expenses
id={{=expense.id}}
onmouseover=jQuery(this).attr(style.backgroundColor='lightgrey')
onmouseout=jQuery(this).attr(style.backgroundColor='white')

  td{{=expense.datetime}}/td
  td{{=expense.title}}/td
  td{{=expense.category.name}}/td
  td{{=expense.amount}} {{=expense.denomination}}/td
  td{{=expense.source}}/td
/tr
{{pass}}
  /table
 
  hr /
 
  {{=form}}
 
  script
  $(document).ready(function () {
   $('.expenses').click(function(){
ajax('edit_expense?id=' + $(this).attr('id'), [], '#target')
   });});
 
  /script
 
  div id=target/div
 
  I added the AJAX script to have it return to edit_expense the id of the
 row
  that was clicked but I get an error about the crud.create line in my
  controller.
 
  Thanks again for your help.
 
  Tsvi



[web2py] Re: Access remote oracle database

2011-11-24 Thread tomt
Do you have the oracle client installed on your web2py machine?  If
you do, you should be able to test the connection to oracle with
'sqlplus database/password'.

oracle-instantclient is available for free from 
www.oracle.com/technetwork/index.html.
I'm using this on my linux machine to access a remote oracle server
using web2py. I believe this is also available for windows.  I
installed three rpms, basic, sqlplus, and devel.

If you have the oracle client set up, you might want to test if you
can access oracle directly from python before trying it from web2py.

The cx_Oracle source has some good examples of how to do this.

If all this is already working, then post some of the specific errors
you are having and I'll try to help if I can.

- Tom


On Nov 24, 6:36 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Web2py supports oracle. Requires cxoracle and rinning from source.
 What problem do you experience?

 On Nov 24, 12:42 pm, Humberto humbfd...@gmail.com wrote:

  web2py already comes with native oracle support? I installed pyodbc
  and cx_oracle, but I still can't connect to my remote oracle database.

  I tested a connection with postgres (I needed to install psycopg2) and
  it's working fine.

  Ps. My OS is Windows 7 x64.
  Ps2. I tried running the web2py binary and from the source.




[web2py] Re: About transactions

2011-11-24 Thread Jose


On 24 nov, 21:43, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Anthony is right
  if you catch the exception yourself web2py stll commits because does
 not detect failure. If catch the exception and want to rollback you
 have to be explicit. Still. It is in a transaction.

Ok, I understand, this work. Now I ask how I can solve the following:

tb_1 = db.define_table('t1',
Field('field1'),
Field('field2', 'integer'),
Field('field3', 'upload', autodelete=True),
)

tb_2 = db.define_table('t2',
Field('field1'),
Field('field2', 'integer')
)

Note --- autodelete=True
I need it to be this way

in this case is a update

def test():
form = SQLFORM(tb_1, 1)
if form.accepts(request.vars, session):
try:
tb_2.insert(field1='test', field2='1xbx123')

except:
db.rollback()
redirect(URL('error'))
redirect(URL('test'))
elif form.errors:
response.flash = 'errors'
return dict(form=form)

thus lose the original file uploaded

Jose


Re: [web2py] Re: My ideas/proposals for the CMS

2011-11-24 Thread Bruno Rocha
Right now I am developing a Social-CMS.

I am in very beggining of the project, I have all the ideas and directions
but for now only article  user management.

But I am working to finish all the features in one month ( I have a
deadline with a client)

My goal is a model-less app (No models, I mean less models) tables are
defined in modules, the system is:
multi-theme
multi-content-type
multi-tenant
Runs on GAE

A basic sample page http://movucahq.appspot.com/Movuca/home/index

A basic Article of content type Article
http://movucahq.appspot.com/Movuca/article/show/3010/web2py-rocks

A basic Article of content type Cook Recipe
http://movucahq.appspot.com/Movuca/article/show/17004/salad

Every content-type is a class in datamodel module, so the developer can
extend to create your own content-types, in the views and static folders
there are theme/* separated namespaces, it is possible to load themes
dynamically.

I dont have any idea for plugin handling (yet).

That is, The code is in github: https://github.com/rochacbruno/Movuca

Very beggining of the project, THIS IS NOT A CMS, it is a social-network
engine or a Social CMS. Inspired in vikuit.com

I hope to have a pre-alpha version for tests in one month or less.

Bruno.


[web2py] Re: About transactions

2011-11-24 Thread Anthony
On Thursday, November 24, 2011 9:27:06 PM UTC-5, Jose wrote:

 def test():

 form = SQLFORM(tb_1, 1)
 if form.accepts(request.vars, session):
 try:
 tb_2.insert(field1='test', field2='1xbx123')

 except:
 db.rollback()
 redirect(URL('error'))
 redirect(URL('test'))
 elif form.errors:
 response.flash = 'errors'
 return dict(form=form)

 thus lose the original file uploaded

I haven't tried it, but if you set dbio=False in form.accepts, I assume it 
won't touch the file at that point. You can then handle the tb_1 update 
manually after the tb_2 insert in the try block.

Anthony





[web2py] Any simple open-source resources for web2py with database management via restful api?

2011-11-24 Thread haikuvend Resident
Any help is gladly appreciated!


[web2py] Re: Any simple open-source resources for web2py with database management via restful api?

2011-11-24 Thread Massimo Di Pierro
http://web2py.com/book/default/chapter/09#RESTful-Web-Services

On Nov 24, 8:29 pm, haikuvend Resident haikuv...@gmail.com wrote:
 Any help is gladly appreciated!


[web2py] Re: issue with form.process in default/user

2011-11-24 Thread Massimo Di Pierro
My answer did not get posted. Trying again...

auth.settings.register_onvalidation = do_my_postvalidation_stuff
auth.messages.registration_successful =  'Thank you for registering'
form = auth.register()  #does its own call to form.process()

OR

form = SQLFORM(db.auth_user)
if form.process(onvalidation=do_my_postvalidation_stuff).accepted:
   session.flash = 'Thank you for registering'

On Nov 25, 12:22 am, Dave dave.st...@gmail.com wrote:
 I'm a bit stumped on this one...

 I need to do some 'stuff' after either a user registeres or updates
 their profile.  Basically there's a half dozen boolean fields which
 correspond to mailing lists the user may opt-in to.  I tried
 customizing the default/user controller like so:

 form = auth.register()

 if form.process(onvalidation=do_my_postvalidation_stuff).accepted:
    session.flash = 'Thank you for registering'

 It seems that the form.process OR form.accepts(request,session) does
 not work if I let the form be generated by using form = auth() or form
 = auth.register().

 Short of writing my own whole registration and profile management
 controllers, is there an easy work around here?  When I submit the
 form nothing happens.  I've even tried putting a debug `print 'got
 here'` type message inside the validation method and if construct
 above.