[web2py] Test if client has javascript

2011-02-09 Thread ma...@rockiger.com
I am using disqus as comment system. This only works for client that have 
javascript enabled.
I am programming a fallback for clients that don't have javascript (esp. 
Google).

I am curios, if there is a way, to see if javascript is enabled on the 
client making a request to a website?
This way I could save on database requests

Regards,
Marco




Re: [web2py] Test if client has javascript

2011-02-09 Thread Running Clam

Hi,

On 09/02/2011 09:46, m momin wrote:

stop my mesage



Every message from the list has a hint in the headers as to how to 
un-subscribe: -


List-Unsubscribe: 
, 



You are sending your instructions to the group members, who cannot help 
you - only you can manage your subscription.


HTH


--

Cheers,

Clam


[web2py] Re: SQLFORM and read-only references

2011-02-09 Thread Juan Antonio
Yes, the nightly built works fine. Thanks.


On 7 feb, 15:44, Massimo Di Pierro  wrote:
> Should be fixed in trunk already. Try the nightly built.
>
> On Feb 7, 4:46 am, Juan Antonio  wrote:
>
> > I have
>
> > db.define_table('article', Field('name'),,format='%(name)s')
> > db.define_table('lote', Field('name'),, Field('article',
> > db.article)
> > db.lote.article.requires = IS_IN_DB(db, db.article.id, '%(name)s')
>
> > AndSQLFORM(db.lote,..,readonly=True) shows 'None' in field articulo
>
> > I think it is the same proble discussed here, or what am I doing
> > wrong?
>
> > I am using 1.91.6
>
> > Cheers,
>
> > Juan.
>
> > On 4 feb, 13:46, Kenneth  wrote:
>
> > > I´m having the same problem. In aSQLFORMI have a Field that is
> > > sometimes writable and sometimes not. If you are admin you can modify
> > > this field but not as user. Field is a reference to and other table,
> > > so admin gets a dropdown but the user gets None but he should get the
> > > selection that admin has made.
>
> > > Kenneth
>
> > > On Jan 26, 11:48 pm, Pawel Jasinski  wrote:
>
> > > > Hi,
>
> > > > > Are you sure you want the formreadonly?
>
> > > > Yes
>
> > > > > What if you removereadonly?
>
> > > > The 'None' changes into drop down with ids or whatever is in the
> > > > format argument of the field.
>
> > > > > If you wantreadonlyyou do not need accepts
>
> > > > Good point, changed. It does not help with the main problem.
>
> > > > I also have another use case, where form is used on the confirmation
> > > > screen. Kind of "are you really sure ..."
> > > > All fields are maderead onlywith db.table.filed.writable=False.
> > > > Thereferencesare also rendered as None.
>
> > > > Cheers,
> > > > Pawel


[web2py] Re: Book needs to be updated

2011-02-09 Thread cjrh
On Feb 8, 11:00 pm, pbreit  wrote:
> I kind of liked the old admin better. Are we really set on the new admin?

I strongly recommend a book-friendly theme for such screenshots, which
means lots of white, and little or no text on non-white backgrounds.


[web2py] Re: email verification in user/profile

2011-02-09 Thread LightOfMooN
No ways to do it?
Like in registration with
auth.settings.registration_requires_verification = True

On 8 фев, 23:00, LightOfMooN  wrote:
> Hi!
> When I changed email using user/profile form, it's not verify it.
> How can I make it works to verify email using user/profile form?


[web2py] Re: simple pyquestion dictionaries

2011-02-09 Thread cjrh
On Feb 8, 7:04 pm, António Ramos  wrote:
> var1={'1':'','2':'','3':'','4':'','5':'','6':'','7':'','8':'','9':'','10':'­','11':'','12':'','13':'','14':'','15':'','16':'','17':'','18':'','19':''}

def f(i, d={}):
if i<=0:
return d
return f(i-1, dict(d.items() + [(str(i), '')]))

print f(19)

“To iterate is human, to recurse divine.”
(L. Peter Deutsch)

"I wouldn't actually do it this way in my own code"
(Me)


[web2py] Re: plugin_wiki suggestions

2011-02-09 Thread villas
If you just want to print the variable 'heading' that you've defined,
put this in your page:
``
{{
=header
}}
``:template


On Feb 9, 12:53 am, Plumo  wrote:
> OK I assume there is not.
>
> I placed the following in meta-code:
>
> heading = 'abc'
>
> But the wiki pages throw an error that heading is undefined.
>
> I also tried:
>
> {{
>
> heading = 'abc'
>
> }}
>
> and:
>
> ``
>
> {{
>
> heading = 'abc'
>
> }}
>
> ``:template
>
> but heading is still undefined.
>
> The editor level is set to 3. Is there anything else that needs to be done
> to activate meta-code?


[web2py] Trouble using web2py with remotely hosted CouchDB

2011-02-09 Thread poplar
Hi! This is my first experiment with web2py, and I'm hoping to use a
CouchDB Futon at couchone.com. I'm running on OS X 10.3.9 with couchdb-
python version 0.8. I tried the current stable trunk version of web2py
but couldn't bring up the welcome app because of hitting the bug
reported here in January about the Server object not having the
attribute 'commit', so I downloaded the development branch to get the
fix. In the welcome app's db.py, I commented out the sqlite usage and
substituted:

db = DAL('couchdb://username:passw...@myaccount.couchone.com/
_utils')

I successfully brought up the welcome app and created a new trial
application. Then I tried to insert an authorized user in order to
check if the database was working. The app gave me a ticket saying:

web2py™ Version 1.91.6 (2011-02-06 09:39:31)
Python  Python 2.7.1: /Library/Frameworks/Python.framework/Versions/
2.7/Resources/Python.app/Contents/MacOS/Python
Traceback

Traceback (most recent call last):
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/
restricted.py", line 188, in restricted
exec ccode in environment
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/applications/
bibserver/controllers/appadmin.py", line 412, in 
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/globals.py",
line 95, in 
self._caller = lambda f: f()
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/applications/
bibserver/controllers/appadmin.py", line 127, in insert
if form.accepts(request.vars, session):
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/sqlhtml.py",
line 1015, in accepts
hideerror=hideerror,
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/html.py",
line 1713, in accepts
status = self._traverse(status,hideerror)
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/html.py",
line 713, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/html.py",
line 713, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/html.py",
line 713, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/html.py",
line 713, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/html.py",
line 720, in _traverse
newstatus = self._validate()
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/html.py",
line 1490, in _validate
(value, errors) = validator(value)
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/
validators.py", line 508, in __call__
rows = self.dbset(field == value).select(limitby=(0, 1))
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/dal.py", line
4593, in select
return self.db._adapter.select(self.query,fields,attributes)
  File "/Users/poplar/Desktop/Code/bzr-2.3.0/devel/gluon/dal.py", line
2941, in select
ctable = self.connection[tablename]
  File "build/bdist.macosx-10.3-ppc/egg/couchdb/client.py", line 137,
in __getitem__
db.resource.head() # actually make a request to the database
  File "build/bdist.macosx-10.3-ppc/egg/couchdb/http.py", line 377, in
head
return self._request('HEAD', path, headers=headers, **params)
  File "build/bdist.macosx-10.3-ppc/egg/couchdb/http.py", line 419, in
_request
credentials=self.credentials)
  File "build/bdist.macosx-10.3-ppc/egg/couchdb/http.py", line 304, in
request
raise ResourceNotFound(error)
ResourceNotFound


Function argument list

(self=, method='HEAD', url='http://
myaccount.couchone.com/_utils/auth_user', body=None,
headers={'Accept': 'application/json', 'Content-Length': '0', 'User-
Agent': 'CouchDB-Python/0.8'}, credentials=None, num_redirects=0)

Thanks for any help!


[web2py] Populating auth_users

2011-02-09 Thread Rafal
Hi


I want to deploy application multiple times with the basic standard
data. Everything works correctly untill I want to add first user (with
some standard password) to auth_user.


I tried
if db(db.auth_user).count() == 0:
db.auth_user.insert(username='test', first_name='test1',
last_name='test2', email='', password='password')
 and the password is not hashed in the database. how do I hash
"manually"
Rafal


[web2py] How to add form vars to crud.create onaccept?

2011-02-09 Thread Tom Atkins
I have something like this which works fine:

commentform = SQLFORM(db.comment)
commentform.vars.post_id = post.id

This populates commentform with the current post id.

How can I do this with crud.create? (I know I need to use the onaccept
method of crud.create but I'm stuck.)


[web2py] Re: URL secure flag.

2011-02-09 Thread Massimo Di Pierro
No objection. I would take the patch.

On Feb 8, 2:59 pm, Jonathan Lundell  wrote:
> On Feb 8, 2011, at 12:24 PM, David J. wrote:
>
>
>
> > Thanks Jonathan;
>
> > This works too;
>
> Good.
>
> This *could* be an option to URL, since it has internal access to request. 
> Suppose we added arguments URL(..., secure=None, host=None).
>
> This case would mean the current behavior. Secure could be True or False for 
> https/http. Host could be a string.
>
> Specifying just a host would mean: use scheme from request.env.
>
> Specifying just secure True/False would mean: use host from request.env.
>
> The host & scheme would be prepended after all rewriting.
>
>
>
>
>
>
>
>
>
> > Thanks;
>
> > On 2/8/11 3:11 PM, Jonathan Lundell wrote:
> >> On Feb 8, 2011, at 11:41 AM, David J. wrote:
> >>> Well than maybe someone could inform them; ;)
>
> >>> It would be useful; My current work around is to make the whole site 
> >>> secure cringe;
> >> If you know that the host info is valid, you could write:
>
> >>        'https://%s%s' % (request.env.http_host, URL("function"))
>
> >> web2py has no guarantee of knowing the host name; that depends on how it's 
> >> deployed (consider the case of a proxy).
>
> >>> On 2/8/11 2:36 PM, Massimo Di Pierro wrote:
>  Because the URL function does not know the "https://example.com";. Only
>  the web server knows it.
>
>  We do have a URL(,sign=) option to digitally sign URLs.
>
>  On Feb 8, 12:58 pm, "David J."   wrote:
> > I was wondering why URL does not include a secure flag?
>
> > I think it should be able to set "secure" url's
>
> > For example if you do URL("function",secure=True)
>
> > We generate a complete URL
>
> >https://example.com/welcome/default/function


[web2py] Re: integration of jquery's ui themes into web2py's default layout/css?

2011-02-09 Thread Massimo Di Pierro
If you can go through the excercise of fguring out how to change the
base.css default web2py css to make it jquery-ui friendly, I will be
happy to change it.

On Feb 8, 5:39 pm, Carlos  wrote:
> Hi all,
>
> What's the best way to integrate jquery's ui themes into web2py's default
> layout/css without causing css conflicts?.
>
>    http://jqueryui.com/download
>
> I downloaded the smoothness theme and inserted the following lines in web2py
> model (after renaming the downloaded files):
>
>    response.files.append(URL('static','js/jquery-ui.js'))
>    response.files.append(URL('static','css/jquery-ui.css'))
>
> Then I used the dialog widget:
>
>    $('#x').dialog('open')
>
> But when the dialog window opens I can see several css inconsistences
> applied to its content, e.g. labels.
>
> For reference I can see the following css rules are being applied to the
> dialog contents (which alter web2py's default css):
>    .ui-widget
>    .ui-widget-content
>
> Is there a known way to easily reconcile these differences?, or am I doing
> something wrong?.
>
> Thanks,
>
>    Carlos


[web2py] Re: Inform user of registration approval

2011-02-09 Thread Massimo Di Pierro
The process of approval consists of editing the auth_user record. If
you do it via appadmin there is no way. If you create your own action
to approve a record you could send an email. You still have to code it
but it a few lines.

On Feb 8, 6:44 pm, bluemoth  wrote:
> Hi all,
>
> Is there a way to inform a new user that their registration has been
> approved?
>
> Cheers, Duane.


[web2py] Re: plugin_wiki suggestions

2011-02-09 Thread blackthorne
Would you consider the idea of putting plugin_wiki source code in a
(git?) repository for versioning?

On Feb 7, 2:26 pm, Massimo Di Pierro 
wrote:
> If you are in mode 3 (code allowed) you can do ``{{=response.title}}
> ``:template
>
> On Feb 7, 12:29 am, Plumo  wrote:
>
>
>
> > I also made this change to set the page title.
>
> > How can I access the page title from within a wiki page?
> > response.title is empty


[web2py] Re: auth.signature

2011-02-09 Thread Massimo Di Pierro
I agree I was thinking about it. Use case:


Instead of:

db.define_table('message',Field('body'))
form = crud.create(db.message)
form = crud.update(db.message,message_id)

do

db.define_table('message',Field('body'),auth.signature)
form = crud.create(db.message)
form = crud.update(db.message,message_id,onaccept=crud.archive)

Now all records are timestamped, signed by the author, and versioned.



On Feb 8, 7:03 pm, Vinicius Assef  wrote:
> Massimo, it's really very good.
>
> What about including "is_active" to represent record active (True) or
> not (False)?
>
> The ideia is work like dBase III Plus. It had a flag indicating if the
> record was active or deleted. Then, the "pack" command made a real
> delete.
>
> --
> Vinicius Assef.
>
>
>
>
>
>
>
> On Tue, Feb 8, 2011 at 6:39 PM, villas  wrote:
> > For those intrigued and cannot update to trunk right now, it creates
> > some extra fields...
>
> > ['id', 'whatever', 'created_on', 'created_by', 'modified_on',
> > 'updated_by']
>
> > Nice shortcut, but I never guessed from the name 'auth.signature' what
> > it would do.
> > Maybe a different name would be clearer?  e.g. 'auth.rectimestamp'


[web2py] Re: Additional Queries on Login.

2011-02-09 Thread Massimo Di Pierro
The idea is correct but f should be the form and you should not save a
record in session without converting to a python dict.

def load_settings(form):
 settings = db.settings(db.settings.user == form.vars.id)
 session.settings = settings.as_dict()

auth.settings.login_onaccept = lambda form:load_settings(form)

On Feb 8, 11:33 pm, "David J."  wrote:
> I am using the default web2py login mechanism;
>
> I am not sure where I can run additional queries after a successful login?
>
> I tried doing
>
> def load_settings(f):
>      settings = db.settings(db.settings.user == f.id)
>      session.settings = settings
>      return
>
> auth.settings.login_onaccept = lambda f:load_settings(f)
>
> This anyway throws an exception;
>
> Even if this were to work; would this be the best place to do this?
>
> I want to store the settings on the "Profile" page
>
> The settings are read only on that page they click a link to modify the
> setting which handles all the CRUD methods.
>
> Any advice would be greatly appreciated.
>
> Thanks.


[web2py] Re: A little error running web2py.py -S

2011-02-09 Thread Massimo Di Pierro
Sorry. To use ldap you need to install the ldap module.

sudo easy_install python-ldap

On Feb 9, 1:45 am, Panupat  wrote:
> trying to import ldap_auth. Got a little error when running web2py.py -
> S
>
> C:\web2py>python web2py.py -S welcome -M
> ..
> Version 1.91.6 (2011-01-03 17:55:14)
> ..
> WARNING:web2py:import IPython error; use default python shell
> Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit
> (AMD64)] on win32
>
> And when I try to import ldap_auth, seems like python is not
> recognizing the _auth part. Directory is pointing to the correct
> location for ldap_auth.py
>
> >>> import gluon.contrib.login_methods.ldap_auth
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\web2py\gluon\contrib\login_methods\ldap_auth.py", line 1,
> in  import ldap
> ImportError: No module named ldap


[web2py] Re: simple pyquestion dictionaries

2011-02-09 Thread Massimo Di Pierro
Not in python. It has no tail recursion so it will crash the
interpreter if you have more than ~1000 terms (depending on how python
was compiled).

On Feb 9, 6:16 am, cjrh  wrote:
> On Feb 8, 7:04 pm, António Ramos  wrote:
>
> > var1={'1':'','2':'','3':'','4':'','5':'','6':'','7':'','8':'','9':'','10':' 
> > ­','11':'','12':'','13':'','14':'','15':'','16':'','17':'','18':'','19':''}
>
> def f(i, d={}):
>     if i<=0:
>         return d
>     return f(i-1, dict(d.items() + [(str(i), '')]))
>
> print f(19)
>
> “To iterate is human, to recurse divine.”
> (L. Peter Deutsch)
>
> "I wouldn't actually do it this way in my own code"
> (Me)


Re: [web2py] Re: Additional Queries on Login.

2011-02-09 Thread David J.

Fantastic;

I got it working another way; but I will change to this much more concise;

I called auth.user.id instead which worked;

Is there any drawbacks to the way I did it? I think one uses the 
authenticated user while yours passes the form that was just submitted...


Thanks.




On 2/9/11 10:09 AM, Massimo Di Pierro wrote:

The idea is correct but f should be the form and you should not save a
record in session without converting to a python dict.

def load_settings(form):
  settings = db.settings(db.settings.user == form.vars.id)
  session.settings = settings.as_dict()

auth.settings.login_onaccept = lambda form:load_settings(form)

On Feb 8, 11:33 pm, "David J."  wrote:

I am using the default web2py login mechanism;

I am not sure where I can run additional queries after a successful login?

I tried doing

def load_settings(f):
  settings = db.settings(db.settings.user == f.id)
  session.settings = settings
  return

auth.settings.login_onaccept = lambda f:load_settings(f)

This anyway throws an exception;

Even if this were to work; would this be the best place to do this?

I want to store the settings on the "Profile" page

The settings are read only on that page they click a link to modify the
setting which handles all the CRUD methods.

Any advice would be greatly appreciated.

Thanks.




[web2py] Re: Populating auth_users

2011-02-09 Thread Massimo Di Pierro
password=db.auth_user.password.validate('password')[0]

On Feb 9, 5:10 am, Rafal  wrote:
> Hi
>
> I want to deploy application multiple times with the basic standard
> data. Everything works correctly untill I want to add first user (with
> some standard password) to auth_user.
>
> I tried
> if db(db.auth_user).count() == 0:
> db.auth_user.insert(username='test', first_name='test1',
> last_name='test2', email='', password='password')
>  and the password is not hashed in the database. how do I hash
> "manually"
> Rafal


[web2py] Re: plugin_wiki suggestions

2011-02-09 Thread Massimo Di Pierro
It is in google code, inside the example app:

http://code.google.com/p/cube2py/



On Feb 9, 8:36 am, blackthorne  wrote:
> Would you consider the idea of putting plugin_wiki source code in a
> (git?) repository for versioning?
>
> On Feb 7, 2:26 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > If you are in mode 3 (code allowed) you can do ``{{=response.title}}
> > ``:template
>
> > On Feb 7, 12:29 am, Plumo  wrote:
>
> > > I also made this change to set the page title.
>
> > > How can I access the page title from within a wiki page?
> > > response.title is empty


[web2py] Re: How to add form vars to crud.create onaccept?

2011-02-09 Thread Massimo Di Pierro
db.comment.post_id.default = post.id
form = crud.create(db.comment)

On Feb 9, 8:43 am, Tom Atkins  wrote:
> I have something like this which works fine:
>
>     commentform = SQLFORM(db.comment)
>             commentform.vars.post_id = post.id
>
> This populates commentform with the current post id.
>
> How can I do this with crud.create? (I know I need to use the onaccept
> method of crud.create but I'm stuck.)


[web2py] Re: web2py is running on dotCloud

2011-02-09 Thread Anthony
I submitted a few corrections to the DotCloud tutorial (
http://docs.dotcloud.com/static/tutorials/web2py/). If anyone sees any other 
errors or has additional feedback, you can contact DotCloud directly, or let 
me know and I'll pass it along.
 
Also, here's a link about it on Reddit: 
http://www.reddit.com/r/Python/comments/fi1tk/web2py_is_running_on_dotcloud_tutorial_link_in/
 

On Tuesday, February 1, 2011 11:38:26 PM UTC-5, Anthony wrote:

> Cool. Thanks for putting up that demo.
>  
> Everyone, the DotCloud CEO recently offered folks on this list beta 
> invites: https://groups.google.com/d/msg/web2py/eRARkDuYGn4/VJ9twwOA3-cJ
>  
> They also recently added a web2py setup tutorial to their documentation: 
> http://docs.dotcloud.com/static/tutorials/web2py/. I emailed them to 
> request they add the tutorial link to their main documentation page (which 
> they did), and they said they were interested in feedback on the tutorial so 
> they can improve it -- so try it out, and send them any feedback. Right now, 
> Django is the only other Python framework with a tutorial there.
>  
> Anthony
>
> On Tuesday, February 1, 2011 11:02:11 PM UTC-5, rochacbruno wrote:
>
>> Take it a look: 
>>
>> http://www.web2py.dotcloud.com/welcome/default/index
>>
>> definitely the 'heroku' for web2py
>>
>> So easy
>>
>> $dotcloud deploy -t python myweb2pyapp.www
>>
>> $ln -s wsgihandler.py wsgi.py
>>
>> $cd path/to/my/web2py
>>
>> $dotcloud push myweb2pyapp.www
>>
>> $...
>> rsync
>>
>>
>>  
>> and 
>> http://www.web2py.dotcloud.com
>>
>>
>> I am a little busy now, but I will try it with PostGreSQL tomorrow
>>
>>
>> --
>> Bruno Rocha
>> http://about.me/rochacbruno/bio
>>
>

Re: [web2py] Re: web2py is running on dotCloud

2011-02-09 Thread Bruno Rocha
I can put the tutorial link in the demo application, I will do that!


2011/2/9 Anthony 

> I submitted a few corrections to the DotCloud tutorial (
> http://docs.dotcloud.com/static/tutorials/web2py/). If anyone sees any
> other errors or has additional feedback, you can contact DotCloud directly,
> or let me know and I'll pass it along.
>
> Also, here's a link about it on Reddit:
> http://www.reddit.com/r/Python/comments/fi1tk/web2py_is_running_on_dotcloud_tutorial_link_in/
>
>
> On Tuesday, February 1, 2011 11:38:26 PM UTC-5, Anthony wrote:
>
>> Cool. Thanks for putting up that demo.
>>
>> Everyone, the DotCloud CEO recently offered folks on this list beta
>> invites: https://groups.google.com/d/msg/web2py/eRARkDuYGn4/VJ9twwOA3-cJ
>>
>> They also recently added a web2py setup tutorial to their documentation:
>> http://docs.dotcloud.com/static/tutorials/web2py/. I emailed them to
>> request they add the tutorial link to their main documentation page (which
>> they did), and they said they were interested in feedback on the tutorial so
>> they can improve it -- so try it out, and send them any feedback. Right now,
>> Django is the only other Python framework with a tutorial there.
>>
>> Anthony
>>
>> On Tuesday, February 1, 2011 11:02:11 PM UTC-5, rochacbruno wrote:
>>
>>> Take it a look:
>>>
>>> http://www.web2py.dotcloud.com/welcome/default/index
>>>
>>> definitely the 'heroku' for web2py
>>>
>>> So easy
>>>
>>>
>>> $dotcloud deploy -t python myweb2pyapp.www
>>>
>>>
>>> $ln -s wsgihandler.py wsgi.py
>>>
>>>
>>> $cd path/to/my/web2py
>>>
>>>
>>> $dotcloud push myweb2pyapp.www
>>>
>>>
>>> $...
>>> rsync
>>>
>>>
>>>  
>>> and 
>>> http://www.web2py.dotcloud.com
>>>
>>>
>>> I am a little busy now, but I will try it with PostGreSQL tomorrow
>>>
>>>
>>> --
>>> Bruno Rocha
>>> http://about.me/rochacbruno/bio
>>>
>>


Re: [web2py] Re: How to add form vars to crud.create onaccept?

2011-02-09 Thread Tom Atkins
On 9 February 2011 15:18, Massimo Di Pierro wrote:

> db.comment.post_id.default = post.id
> form = crud.create(db.comment)


Doh! Thank you!


[web2py] Re: web2py is running on dotCloud

2011-02-09 Thread Massimo Di Pierro
this is really cool!

On Feb 9, 9:19 am, Anthony  wrote:
> I submitted a few corrections to the DotCloud tutorial 
> (http://docs.dotcloud.com/static/tutorials/web2py/). If anyone sees any other
> errors or has additional feedback, you can contact DotCloud directly, or let
> me know and I'll pass it along.
>
> Also, here's a link about it on 
> Reddit:http://www.reddit.com/r/Python/comments/fi1tk/web2py_is_running_on_do...
>
>
>
>
>
>
>
> On Tuesday, February 1, 2011 11:38:26 PM UTC-5, Anthony wrote:
> > Cool. Thanks for putting up that demo.
>
> > Everyone, the DotCloud CEO recently offered folks on this list beta
> > invites:https://groups.google.com/d/msg/web2py/eRARkDuYGn4/VJ9twwOA3-cJ
>
> > They also recently added a web2py setup tutorial to their documentation:
> >http://docs.dotcloud.com/static/tutorials/web2py/. I emailed them to
> > request they add the tutorial link to their main documentation page (which
> > they did), and they said they were interested in feedback on the tutorial so
> > they can improve it -- so try it out, and send them any feedback. Right now,
> > Django is the only other Python framework with a tutorial there.
>
> > Anthony
>
> > On Tuesday, February 1, 2011 11:02:11 PM UTC-5, rochacbruno wrote:
>
> >> Take it a look:
>
> >>http://www.web2py.dotcloud.com/welcome/default/index
>
> >> definitely the 'heroku' for web2py
>
> >> So easy
>
> >> $dotcloud deploy -t python myweb2pyapp.www
>
> >> $ln -s wsgihandler.py wsgi.py
>
> >> $cd path/to/my/web2py
>
> >> $dotcloud push myweb2pyapp.www
>
> >> $...
> >> rsync
>
> >>  
> >> andhttp://www.web2py.dotcloud.com
>
> >> I am a little busy now, but I will try it with PostGreSQL tomorrow
>
> >> --
> >> Bruno Rocha
> >>http://about.me/rochacbruno/bio


Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 6:58 AM, Massimo Di Pierro wrote:
> 
> No objection. I would take the patch.

I'll work one up. Input on the exact argument syntax is welcome.

> 
> On Feb 8, 2:59 pm, Jonathan Lundell  wrote:
>> On Feb 8, 2011, at 12:24 PM, David J. wrote:
>> 
>> 
>> 
>>> Thanks Jonathan;
>> 
>>> This works too;
>> 
>> Good.
>> 
>> This *could* be an option to URL, since it has internal access to request. 
>> Suppose we added arguments URL(..., secure=None, host=None).
>> 
>> This case would mean the current behavior. Secure could be True or False for 
>> https/http. Host could be a string.
>> 
>> Specifying just a host would mean: use scheme from request.env.
>> 
>> Specifying just secure True/False would mean: use host from request.env.
>> 
>> The host & scheme would be prepended after all rewriting.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Thanks;
>> 
>>> On 2/8/11 3:11 PM, Jonathan Lundell wrote:
 On Feb 8, 2011, at 11:41 AM, David J. wrote:
> Well than maybe someone could inform them; ;)
>> 
> It would be useful; My current work around is to make the whole site 
> secure cringe;
 If you know that the host info is valid, you could write:
>> 
'https://%s%s' % (request.env.http_host, URL("function"))
>> 
 web2py has no guarantee of knowing the host name; that depends on how it's 
 deployed (consider the case of a proxy).
>> 
> On 2/8/11 2:36 PM, Massimo Di Pierro wrote:
>> Because the URL function does not know the "https://example.com";. Only
>> the web server knows it.
>> 
>> We do have a URL(,sign=) option to digitally sign URLs.
>> 
>> On Feb 8, 12:58 pm, "David J."   wrote:
>>> I was wondering why URL does not include a secure flag?
>> 
>>> I think it should be able to set "secure" url's
>> 
>>> For example if you do URL("function",secure=True)
>> 
>>> We generate a complete URL
>> 
>>> https://example.com/welcome/default/function




Re: [web2py] Re: URL secure flag.

2011-02-09 Thread David J.

how about "secure" or "enable_ssl" or "transport" or "is_secure"

Although "secure" is probably the most intuitive;



On 2/9/11 11:20 AM, Jonathan Lundell wrote:

On Feb 9, 2011, at 6:58 AM, Massimo Di Pierro wrote:

No objection. I would take the patch.

I'll work one up. Input on the exact argument syntax is welcome.


On Feb 8, 2:59 pm, Jonathan Lundell  wrote:

On Feb 8, 2011, at 12:24 PM, David J. wrote:




Thanks Jonathan;
This works too;

Good.

This *could* be an option to URL, since it has internal access to request. 
Suppose we added arguments URL(..., secure=None, host=None).

This case would mean the current behavior. Secure could be True or False for 
https/http. Host could be a string.

Specifying just a host would mean: use scheme from request.env.

Specifying just secure True/False would mean: use host from request.env.

The host&  scheme would be prepended after all rewriting.










Thanks;
On 2/8/11 3:11 PM, Jonathan Lundell wrote:

On Feb 8, 2011, at 11:41 AM, David J. wrote:

Well than maybe someone could inform them; ;)
It would be useful; My current work around is to make the whole site secure 
cringe;

If you know that the host info is valid, you could write:
'https://%s%s' % (request.env.http_host, URL("function"))
web2py has no guarantee of knowing the host name; that depends on how it's 
deployed (consider the case of a proxy).

On 2/8/11 2:36 PM, Massimo Di Pierro wrote:

Because the URL function does not know the "https://example.com";. Only
the web server knows it.
We do have a URL(,sign=) option to digitally sign URLs.
On Feb 8, 12:58 pm, "David J."wrote:

I was wondering why URL does not include a secure flag?
I think it should be able to set "secure" url's
For example if you do URL("function",secure=True)
We generate a complete URL
https://example.com/welcome/default/function







Re: [web2py] Re: plugin_wiki suggestions

2011-02-09 Thread Albert Abril
The WATCH THE VIDEO link is broken at Google Code.
I guess it should link to this one: http://vimeo.com/13485916

Regards!

On Wed, Feb 9, 2011 at 4:17 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> It is in google code, inside the example app:
>
> http://code.google.com/p/cube2py/
>
>
>
> On Feb 9, 8:36 am, blackthorne  wrote:
> > Would you consider the idea of putting plugin_wiki source code in a
> > (git?) repository for versioning?
> >
> > On Feb 7, 2:26 pm, Massimo Di Pierro 
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> > > If you are in mode 3 (code allowed) you can do ``{{=response.title}}
> > > ``:template
> >
> > > On Feb 7, 12:29 am, Plumo  wrote:
> >
> > > > I also made this change to set the page title.
> >
> > > > How can I access the page title from within a wiki page?
> > > > response.title is empty
>


Re: [web2py] Re: Populating auth_users

2011-02-09 Thread Bruno Rocha
I also use this function made by @martinmulone

#
def new_user(first_name, last_name, email, passw):
users = db(db.auth_user.email==email).select()
if users:
return users[0].id
else:
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(passw)[0]
id_user= db.auth_user.insert(
   first_name=first_name,
   last_name=last_name,
   email = email,
   password = crypt_pass

   )
return id_user


iduser = new_user('Jon','Doe','j...@nobody.com ','123456')

###


Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 8:33 AM, David J. wrote:
> 
> how about "secure" or "enable_ssl" or "transport" or "is_secure"
> 
> Although "secure" is probably the most intuitive;

I'm leaning toward the syntax below. An alternative to 'secure' is 'scheme', in 
which case the values would be 'http' or 'https', or True to use the scheme in 
request.env. The last option isn't explicit with 'secure', but I don't think 
it's required.

> 
> 
> 
> On 2/9/11 11:20 AM, Jonathan Lundell wrote:
>> On Feb 9, 2011, at 6:58 AM, Massimo Di Pierro wrote:
>>> No objection. I would take the patch.
>> I'll work one up. Input on the exact argument syntax is welcome.
>> 
>>> On Feb 8, 2:59 pm, Jonathan Lundell  wrote:
 On Feb 8, 2011, at 12:24 PM, David J. wrote:
 
 
 
> Thanks Jonathan;
> This works too;
 Good.
 
 This *could* be an option to URL, since it has internal access to request. 
 Suppose we added arguments URL(..., secure=None, host=None).
 
 This case would mean the current behavior. Secure could be True or False 
 for https/http. Host could be a string.
 
 Specifying just a host would mean: use scheme from request.env.
 
 Specifying just secure True/False would mean: use host from request.env.
 
 The host&  scheme would be prepended after all rewriting.
 
 
 
 
 
 
 
 
 
> Thanks;
> On 2/8/11 3:11 PM, Jonathan Lundell wrote:
>> On Feb 8, 2011, at 11:41 AM, David J. wrote:
>>> Well than maybe someone could inform them; ;)
>>> It would be useful; My current work around is to make the whole site 
>>> secure cringe;
>> If you know that the host info is valid, you could write:
>>'https://%s%s' % (request.env.http_host, URL("function"))
>> web2py has no guarantee of knowing the host name; that depends on how 
>> it's deployed (consider the case of a proxy).
>>> On 2/8/11 2:36 PM, Massimo Di Pierro wrote:
 Because the URL function does not know the "https://example.com";. Only
 the web server knows it.
 We do have a URL(,sign=) option to digitally sign URLs.
 On Feb 8, 12:58 pm, "David J."wrote:
> I was wondering why URL does not include a secure flag?
> I think it should be able to set "secure" url's
> For example if you do URL("function",secure=True)
> We generate a complete URL
> https://example.com/welcome/default/function
>> 
>> 
> 




[web2py] Hosting Web2py on Domain.com

2011-02-09 Thread Ahmed Bani

Hello,

I am new to the web2py community, and I am so exited to start on my first 
application.

I have two questions:

1- Can I upload web2py to domain.com ? ( They have gave me some information 
about their CGI and python support which I posted below my questions, here)

2- What folders do I have to upload to the server to make it work (other 
than admin, examples, welcome folders) ? 

Best regards,

Tazjel


*The following information is from domain.com *


The Common Gateway Interface is a way of connecting your web pages to other 
programs that are running on the server which visitors wouldn't normally 
have access to. Most corporate web sites on the Internet today make use of 
CGI programs or scripts to allow their visitors to browse online catalogues 
or keep track of their orders in real time.

You have an ability to use CGI scripts on your website. The subdirectory 
"webspace/cgi-bin" located in your home directory is intended for storing 
your cgi files.

Before testing that CGI really works, devote a couple of minutes to read the 
information you might find necessary.
Paths and Versions:
Perl Version5.8.1.
Path to Perl/usr/bin/perl
GID48
Supported Extensions.pl, .cgi

Python Version2.5.1
Path to Python/usr/local/bin/python
Supported Extension.py Supported ModulesBase Modules, 
MySQLdb

Path to Sendmail/usr/sbin/sendmail
Operating SystemRedHat Linux

CGI Directory/cgi-bin/

The URL to your CGIs is as follows: http://domainname/cgi-bin/cgi-script
Replace the “domainname” with the real name of your domain and “cgi-script” 
with the script name.

Here are some tips for you to bear in mind when using CGI:
• Perl-scripts being transferred via FTP should be in “ASCII” code, not in 
“binary”.
• All scripts are executed only in cgi-bin directory.
• After uploading cgi-script change its permission to 755. Use the PEM File 
Manager to do this quickly. 


Re: [web2py] Hosting Web2py on Domain.com

2011-02-09 Thread contatogilson...@gmail.com
Recommend the webfaction.com
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/2/9 Ahmed Bani 

>
> Hello,
>
> I am new to the web2py community, and I am so exited to start on my first
> application.
>
> I have two questions:
>
> 1- Can I upload web2py to domain.com ? ( They have gave me some
> information about their CGI and python support which I posted below my
> questions, here)
>
> 2- What folders do I have to upload to the server to make it work (other
> than admin, examples, welcome folders) ?
>
> Best regards,
>
> Tazjel
>
>
> *The following information is from domain.com *
>
>
> The Common Gateway Interface is a way of connecting your web pages to other
> programs that are running on the server which visitors wouldn't normally
> have access to. Most corporate web sites on the Internet today make use of
> CGI programs or scripts to allow their visitors to browse online catalogues
> or keep track of their orders in real time.
>
> You have an ability to use CGI scripts on your website. The subdirectory
> "webspace/cgi-bin" located in your home directory is intended for storing
> your cgi files.
>
> Before testing that CGI really works, devote a couple of minutes to read
> the information you might find necessary.
> Paths and Versions:
> Perl Version5.8.1.
> Path to Perl/usr/bin/perl
> GID48
> Supported Extensions.pl, .cgi
>
> Python Version2.5.1
> Path to Python/usr/local/bin/python
> Supported Extension.py Supported ModulesBase Modules,
> MySQLdb
>
> Path to Sendmail/usr/sbin/sendmail
> Operating SystemRedHat Linux
>
> CGI Directory/cgi-bin/
>
> The URL to your CGIs is as follows: http://domainname/cgi-bin/cgi-script
> Replace the “domainname” with the real name of your domain and “cgi-script”
> with the script name.
>
> Here are some tips for you to bear in mind when using CGI:
> • Perl-scripts being transferred via FTP should be in “ASCII” code, not in
> “binary”.
> • All scripts are executed only in cgi-bin directory.
> • After uploading cgi-script change its permission to 755. Use the PEM File
> Manager to do this quickly.
>


[web2py] Use web2py to run trac anywhere (portable trac)

2011-02-09 Thread Salvor Hardin
Has anyone tried running trac using web2py?

Someone suggested using we2py as a "portable" python, so I'm wondering
if web2py can help me run trac from USB drive, etc.


[web2py] Run the ultra-marathon along with web2py

2011-02-09 Thread Bruno Rocha
@viniciusban wrote an excellent post about web2py, I reddited (waiting
comments)

http://www.reddit.com/r/Python/comments/fi4an/run_the_ultramarathon_along_with_web2py/


--
Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Am I asking wrong? (I got no aswers)

2011-02-09 Thread Offray Vladimir Luna Cárdenas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

I'm really interested in learning web2py for developing some ideas. But
this is the third time I get no answer from the community. The first two
posts were about how to deal with an error on Instant Press installing
(in Spanish and English mailing list) and the last one was about making
a plugin_wiki the default page instead of the usual one, using
routes.py. None of them got a proper answer and I know that this is a
newbie friendly community where people help/comment on a voluntary
basis, but I'm starting to wonder if I'm making something wrong to get
my mails ignored collectively with that regularity. May be people
doesn't have time or want to answer, but I see another questions got
answered and the talk is running more easily while mines are not. May be
is because I'm too newbie, may be I'm making the wrong questions or may
be is because I'm not a developer and I'm more interested in
understanding the social practices through web2py that web2py itself,
but If I'm making something wrong and that's why I got no answers I will
be willing to help the proper way.

Cheers,

Offray
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNUs4DAAoJEGiex2828ICw4zYH/RkPbLgE1sz+qyvMjRq8wnrF
f1Jm5sruLyhcsBS5ZhAwTI5qOcgiDLqkY2643hMjFFgzXcdPfyelm3dySpmjKnSm
+PAw3ykuU/qGcdCWLJPmoEDi6MktsL5r5UcoSj+vLaKk/yT1druzO6qxFOEnod4q
0FgM6IEPSBzpqYnvnJTispErxo3NqErXy5pQSG7ql4UPHtTHcDhgpvB/qF0ctE6+
HDm7M4wTIA78+eJ0izCUeP9esr3VOPvY461nbo2mr9PExqIdm2ef9E/ejLQ4wcBa
xKmi8+X9Du2GI0M6bf3+jr4UscFrGB0UQwNVbEqCXEmRpQlhGbOW3uUt02U6k/8=
=l4+q
-END PGP SIGNATURE-


Re: [web2py] Hosting Web2py on Domain.com

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 8:49 AM, Ahmed Bani wrote:
> 
> Hello,
> 
> I am new to the web2py community, and I am so exited to start on my first 
> application.
> 
> I have two questions:
> 
> 1- Can I upload web2py to domain.com ? ( They have gave me some information 
> about their CGI and python support which I posted below my questions, here)
> 
> 2- What folders do I have to upload to the server to make it work (other than 
> admin, examples, welcome folders) ? 

Your cgi file will be cgihandler.py. Note that CGI deployment is going to be 
slow.

The core of web2py is in gluon; you'll need that, but you can leave out 
gluon/tests and probably gluon/contrib (upload individual files if you need 
them). There are some random files like VERSION that web2py expects to see.

Or go ahead and upload the whole mess; it's not that big, and the extra bits 
will do no harm.

I'd try this to begin with: get the web2py source download. Upload it to your 
cgi-bin directory, into its own subdirectory cgi-bin/web2py/. 

Your URL will be http://domainname/cgi-bin/web2py/cgihandler.py (you can worry 
about making it prettier later, especially if you have access to .htaccess). 
Accessing that URL should give you the front page of the welcome app.

I don't recall offhand what you need to do to get administrative access (the 
admin application), but I think you'll need SSL access.

> 
> Best regards,
> 
> Tazjel
> 
> 
> The following information is from domain.com 
> 
> 
> The Common Gateway Interface is a way of connecting your web pages to other 
> programs that are running on the server which visitors wouldn't normally have 
> access to. Most corporate web sites on the Internet today make use of CGI 
> programs or scripts to allow their visitors to browse online catalogues or 
> keep track of their orders in real time.
> 
> You have an ability to use CGI scripts on your website. The subdirectory 
> "webspace/cgi-bin" located in your home directory is intended for storing 
> your cgi files.
> 
> Before testing that CGI really works, devote a couple of minutes to read the 
> information you might find necessary.
> Paths and Versions:
> Perl Version5.8.1.
> Path to Perl/usr/bin/perl
> GID48
> Supported Extensions.pl, .cgi
> 
> Python Version2.5.1
> Path to Python/usr/local/bin/python
> Supported Extension.py Supported ModulesBase Modules, 
> MySQLdb
> 
> Path to Sendmail/usr/sbin/sendmail
> Operating SystemRedHat Linux
> 
> CGI Directory/cgi-bin/
> 
> The URL to your CGIs is as follows: http://domainname/cgi-bin/cgi-script
> Replace the “domainname” with the real name of your domain and “cgi-script” 
> with the script name.
> 
> Here are some tips for you to bear in mind when using CGI:
> • Perl-scripts being transferred via FTP should be in “ASCII” code, not in 
> “binary”.
> • All scripts are executed only in cgi-bin directory.
> • After uploading cgi-script change its permission to 755. Use the PEM File 
> Manager to do this quickly. 




[web2py] how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Richard Vézina
Hello,

I would create button to block or unblock user access, so I made those
function :

def block_access():
"""
UPDATE auth_user
SET registration_key='blocked'
WHERE auth_user.registration_key = ''
  AND auth_user.email <> 'myem...@mydomain.com'
"""
db((db.auth_user.registration_key == '') & (db.auth_user.email != '
myem...@mydomain.com')).update(registration_key='blocked')
db.commit()

def unblock_access():
"""
UPDATE auth_user
SET registration_key=''
WHERE auth_user.registration_key <> 'pending'
"""
db(db.auth_user.registration_key !=
'pending').update(registration_key='')
db.commit()

Now I would call those function from a link or a button from index or admin
dashboard...

I would know if there is a other way except this :

def index():
block_access=A(T('block access'),_href=URL(r=request,c='default',
f='block_access'))
unblock_access=A(T('unblock access'),_href=URL(r=request,c='default',
f='unblock_access'))
return dict(block_access=block_access, unblock_access=unblock_access)

Since I will need to modify the block and unblock function like this :

def block_access():
"""
UPDATE auth_user
SET registration_key='blocked'
WHERE auth_user.registration_key = ''
  AND auth_user.email <> 'myem...@mydomain.com'
"""
db((db.auth_user.registration_key == '') & (db.auth_user.email != '
myem...@mydomain.com')).update(registration_key='blocked')
db.commit()
redirect(URL(r=request,c='default', f='index'))

Is there an other way by not utilising redirection?

Thanks

Richard


Re: [web2py] how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Alexandre Andrade
If I understand the concept, when you set a registration_key in auth_user
table (any value), it don't allow the user to login.

If you want to restrict acess in a menu, I do the following, using
auth_groups, auth_permission and auth_membership:

(you have to create groups, assign permission to them, and them assign the
user to a group)

response.menu = [
(T('Index'), False, URL(request.application,'default','index'), [])
]


if auth.has_permission('representante',''):
response.menu+=[
(T('Conselho Municipal'), False, URL(request.application,
'conselho_municipal', 'index'),
 [
(T('Cadastro'), False, URL(request.application,
'conselho_municipal', 'cadastro')),
(T('Nomeação'), False,  URL(request.application,
'conselho_municipal', 'nomeacao')),
(T('Posse'), False, URL(request.application,
'conselho_municipal', 'posse')),
(T('Conselheiros'), False, URL(request.application,
'conselho_municipal', 'conselheiros')),
(T('Atas'), False, URL(request.application,
'conselho_municipal', 'atas')),
]
   ),


2011/2/9 Richard Vézina 

> Hello,
>
> I would create button to block or unblock user access, so I made those
> function :
>
> def block_access():
> """
> UPDATE auth_user
> SET registration_key='blocked'
> WHERE auth_user.registration_key = ''
>   AND auth_user.email <> 'myem...@mydomain.com'
> """
> db((db.auth_user.registration_key == '') & (db.auth_user.email != '
> myem...@mydomain.com')).update(registration_key='blocked')
> db.commit()
>
> def unblock_access():
> """
> UPDATE auth_user
> SET registration_key=''
> WHERE auth_user.registration_key <> 'pending'
> """
> db(db.auth_user.registration_key !=
> 'pending').update(registration_key='')
> db.commit()
>
> Now I would call those function from a link or a button from index or admin
> dashboard...
>
> I would know if there is a other way except this :
>
> def index():
> block_access=A(T('block access'),_href=URL(r=request,c='default',
> f='block_access'))
> unblock_access=A(T('unblock access'),_href=URL(r=request,c='default',
> f='unblock_access'))
> return dict(block_access=block_access, unblock_access=unblock_access)
>
> Since I will need to modify the block and unblock function like this :
>
> def block_access():
> """
> UPDATE auth_user
> SET registration_key='blocked'
> WHERE auth_user.registration_key = ''
>   AND auth_user.email <> 'myem...@mydomain.com'
> """
> db((db.auth_user.registration_key == '') & (db.auth_user.email != '
> myem...@mydomain.com')).update(registration_key='blocked')
> db.commit()
> redirect(URL(r=request,c='default', f='index'))
>
> Is there an other way by not utilising redirection?
>
> Thanks
>
> Richard
>



-- 
Atenciosamente


Alexandre Andrade
Hipercenter.com Classificados Gratuitos


Re: [web2py] Re: Kind of e-commerce but maybe not

2011-02-09 Thread w2padawan
i'm really interested in this use case. do you know if the this is
really 'impossible' for do as an intranet webapp with web2py?


Re: [web2py] Re: Kind of e-commerce but maybe not

2011-02-09 Thread w2padawan
I'm really interested in this use case. do you know [if this is]
really 'impossible' for do as an intranet web app with web2py?


[web2py] Setting the title tag

2011-02-09 Thread Lorin Rivers
One of the mental challenges I have with mvc/layout approach is how to assign 
values from the "inside-out". Almost all the work I have done so far is in the 
views.

I'd like to dynamically change the title tag (e.g.,  in the  
element).

How does that work?
-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




smime.p7s
Description: S/MIME cryptographic signature


[web2py] Crud formstyle perhaps?

2011-02-09 Thread greenpoise

I am trying to align a crud form horizontally. That is with labels on
top, fields on bottom and they should run across horizontally on the
page. Is crud.settings.formstyle my answer?? Any good example out
there? I searched on the groups with no success...I did find some talk
about it but I just dont know where to code it. The book shows me
this:

crud.settings.formstyle = 'table3cols' or 'table2cols' or 'divs' or
'ul'

Which I dont understand. Appreciate the help

Thanks in advance








[web2py] Re: Setting the title tag

2011-02-09 Thread DenesL
If you are using the default layout.html file then just set
response.title to whatever title you want.


On Feb 9, 1:50 pm, Lorin Rivers  wrote:
> One of the mental challenges I have with mvc/layout approach is how to assign 
> values from the "inside-out". Almost all the work I have done so far is in 
> the views.
>
> I'd like to dynamically change the title tag (e.g.,  in the  
> element).
>
> How does that work?
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)
>
>  smime.p7s
> 6KViewDownload


Re: [web2py] Crud formstyle perhaps?

2011-02-09 Thread Richard Vézina
use 'divs'

Give:
Form
label1
input1
comment1
label2
input2
comment2
etc.

That seems what you looking for...

For comparaison purpose :
table3cols will give :
Form
label1,input1,comment1
etc.

Richard

On Wed, Feb 9, 2011 at 1:52 PM, greenpoise  wrote:

>
> I am trying to align a crud form horizontally. That is with labels on
> top, fields on bottom and they should run across horizontally on the
> page. Is crud.settings.formstyle my answer?? Any good example out
> there? I searched on the groups with no success...I did find some talk
> about it but I just dont know where to code it. The book shows me
> this:
>
> crud.settings.formstyle = 'table3cols' or 'table2cols' or 'divs' or
> 'ul'
>
> Which I dont understand. Appreciate the help
>
> Thanks in advance
>
>
>
>
>
>
>


Re: [web2py] Re: Book needs to be updated

2011-02-09 Thread Richard Vézina
Yeah I thought about it.

We can put a frame around the screenshot... But it will make harder to have
unity between screenshot if it not the same person that make all of them...

Is it that important??

Or we can make a script in gimp for cropping.

Richard

On Wed, Feb 9, 2011 at 6:51 AM, cjrh  wrote:

> On Feb 8, 11:00 pm, pbreit  wrote:
> > I kind of liked the old admin better. Are we really set on the new admin?
>
> I strongly recommend a book-friendly theme for such screenshots, which
> means lots of white, and little or no text on non-white backgrounds.


Re: [web2py] Crud formstyle perhaps?

2011-02-09 Thread Lucas D'Avila
I think this post from Martin can help you >

http://martin.tecnodoc.com.ar/myblog/2011/01/10/hacking-web2py-sqlform-part-1

--

Lucas D'Avila
http://flavors.me/lucasdavila
Em 09/02/2011 16:58, "Richard Vézina" 
escreveu:
> use 'divs'
>
> Give:
> Form
> label1
> input1
> comment1
> label2
> input2
> comment2
> etc.
>
> That seems what you looking for...
>
> For comparaison purpose :
> table3cols will give :
> Form
> label1,input1,comment1
> etc.
>
> Richard
>
> On Wed, Feb 9, 2011 at 1:52 PM, greenpoise 
wrote:
>
>>
>> I am trying to align a crud form horizontally. That is with labels on
>> top, fields on bottom and they should run across horizontally on the
>> page. Is crud.settings.formstyle my answer?? Any good example out
>> there? I searched on the groups with no success...I did find some talk
>> about it but I just dont know where to code it. The book shows me
>> this:
>>
>> crud.settings.formstyle = 'table3cols' or 'table2cols' or 'divs' or
>> 'ul'
>>
>> Which I dont understand. Appreciate the help
>>
>> Thanks in advance
>>
>>
>>
>>
>>
>>
>>


Re: [web2py] Hosting Web2py on Domain.com

2011-02-09 Thread Ahmed Bani

Thanks for the link : http://www.webfaction.com/ ( I will create an account 
with them soon or later them!). 

However, following Mr. Jonathanś instructions will help me to learn more 
about  Web2py.

Mr. Jonathn, I appreciate your help. I will follow your instructions. Then, 
I will update everybody about the results of this project. 

 


[web2py] Re: Crud formstyle perhaps?

2011-02-09 Thread greenpoise
wow, zoom..that was quick...thanks, I will look into both examples...I
like the simplicity of CRUD thats why I rather keep that route.


Thanks

On Feb 9, 11:05 am, "Lucas D'Avila"  wrote:
> I think this post from Martin can help you >
>
> http://martin.tecnodoc.com.ar/myblog/2011/01/10/hacking-web2py-sqlfor...
>
> --
>
> Lucas D'Avilahttp://flavors.me/lucasdavila
> Em 09/02/2011 16:58, "Richard Vézina" 
> escreveu:
>
>
>
> > use 'divs'
>
> > Give:
> > Form
> > label1
> > input1
> > comment1
> > label2
> > input2
> > comment2
> > etc.
>
> > That seems what you looking for...
>
> > For comparaison purpose :
> > table3cols will give :
> > Form
> > label1,input1,comment1
> > etc.
>
> > Richard
>
> > On Wed, Feb 9, 2011 at 1:52 PM, greenpoise 
> wrote:
>
> >> I am trying to align a crud form horizontally. That is with labels on
> >> top, fields on bottom and they should run across horizontally on the
> >> page. Is crud.settings.formstyle my answer?? Any good example out
> >> there? I searched on the groups with no success...I did find some talk
> >> about it but I just dont know where to code it. The book shows me
> >> this:
>
> >> crud.settings.formstyle = 'table3cols' or 'table2cols' or 'divs' or
> >> 'ul'
>
> >> Which I dont understand. Appreciate the help
>
> >> Thanks in advance


Re: [web2py] Re: Setting the title tag

2011-02-09 Thread Lorin Rivers
OK, I'm getting there.

How do I specify response.title in my view?

On Feb 9, 2011, at 12:55 PM, DenesL wrote:

> If you are using the default layout.html file then just set
> response.title to whatever title you want.
> 
> 
> On Feb 9, 1:50 pm, Lorin Rivers  wrote:
>> One of the mental challenges I have with mvc/layout approach is how to 
>> assign values from the "inside-out". Almost all the work I have done so far 
>> is in the views.
>> 
>> I'd like to dynamically change the title tag (e.g.,  in the  
>> element).
>> 
>> How does that work?
>> --
>> Lorin Rivers
>> Mosasaur: Killer Technical Marketing 
>> 
>> 512/203.3198 (m)
>> 
>>  smime.p7s
>> 6KViewDownload

-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




smime.p7s
Description: S/MIME cryptographic signature


Re: [web2py] Re: Book needs to be updated

2011-02-09 Thread pbreit
Is the book content copyrighted? Is it possible to incorporate portions into 
other docs?

[web2py] Re: Problems installing Instant Press

2011-02-09 Thread pbreit
Try downloading the appliance to your hard drive and then installing it as a 
file from your hard drive.

[web2py] Re: Am I asking wrong? (I got no aswers)

2011-02-09 Thread Massimo Di Pierro
I apologize Offray. There is nothing wrong in your posts.

Personally I cannot answer the Instant Press posts because that is not
as much about web2py as it is about an application. I think you should
contact the author for help with it.

About plugin wiki post. It just got lost in the todo list.

Let's say you want to redirect

/yourapp

to

/yourapp/plugin_wiki/page/name

then you would create a file web2py/routes.py that contains

routes_in = [('/yourapp','/yourapp/plugin_wiki/page/name')]

I hope this answers the question. If not please bring it up again.

Anyway, make sure you are running either web2py stable or the current
nightly build. Trunk is always untable and can cause some of the
problems you had with Instant Press, although I am not sure about your
specific problem.


On Feb 9, 11:25 am, Offray Vladimir Luna Cárdenas 
wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> I'm really interested in learning web2py for developing some ideas. But
> this is the third time I get no answer from the community. The first two
> posts were about how to deal with an error on Instant Press installing
> (in Spanish and English mailing list) and the last one was about making
> a plugin_wiki the default page instead of the usual one, using
> routes.py. None of them got a proper answer and I know that this is a
> newbie friendly community where people help/comment on a voluntary
> basis, but I'm starting to wonder if I'm making something wrong to get
> my mails ignored collectively with that regularity. May be people
> doesn't have time or want to answer, but I see another questions got
> answered and the talk is running more easily while mines are not. May be
> is because I'm too newbie, may be I'm making the wrong questions or may
> be is because I'm not a developer and I'm more interested in
> understanding the social practices through web2py that web2py itself,
> but If I'm making something wrong and that's why I got no answers I will
> be willing to help the proper way.
>
> Cheers,
>
> Offray
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNUs4DAAoJEGiex2828ICw4zYH/RkPbLgE1sz+qyvMjRq8wnrF
> f1Jm5sruLyhcsBS5ZhAwTI5qOcgiDLqkY2643hMjFFgzXcdPfyelm3dySpmjKnSm
> +PAw3ykuU/qGcdCWLJPmoEDi6MktsL5r5UcoSj+vLaKk/yT1druzO6qxFOEnod4q
> 0FgM6IEPSBzpqYnvnJTispErxo3NqErXy5pQSG7ql4UPHtTHcDhgpvB/qF0ctE6+
> HDm7M4wTIA78+eJ0izCUeP9esr3VOPvY461nbo2mr9PExqIdm2ef9E/ejLQ4wcBa
> xKmi8+X9Du2GI0M6bf3+jr4UscFrGB0UQwNVbEqCXEmRpQlhGbOW3uUt02U6k/8=
> =l4+q
> -END PGP SIGNATURE-


[web2py] Re: Use web2py to run trac anywhere (portable trac)

2011-02-09 Thread pbreit
Try PortablePython: http://www.portablepython.com/

[web2py] Re: Am I asking wrong? (I got no aswers)

2011-02-09 Thread DenesL
Probably just a coincidence.
As you noted the provided support is free and it is limited by the
person's availability and knowledge.

But, and this is a general comment to all seeking help here, try to
make it easy for others to help you by providing as much relevant info
as you can, maybe even an app that illustrates the case (when
applicable), search the manual and previous post first, make an effort
and show that you did.



On Feb 9, 12:25 pm, Offray Vladimir Luna Cárdenas 
wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> I'm really interested in learning web2py for developing some ideas. But
> this is the third time I get no answer from the community. The first two
> posts were about how to deal with an error on Instant Press installing
> (in Spanish and English mailing list) and the last one was about making
> a plugin_wiki the default page instead of the usual one, using
> routes.py. None of them got a proper answer and I know that this is a
> newbie friendly community where people help/comment on a voluntary
> basis, but I'm starting to wonder if I'm making something wrong to get
> my mails ignored collectively with that regularity. May be people
> doesn't have time or want to answer, but I see another questions got
> answered and the talk is running more easily while mines are not. May be
> is because I'm too newbie, may be I'm making the wrong questions or may
> be is because I'm not a developer and I'm more interested in
> understanding the social practices through web2py that web2py itself,
> but If I'm making something wrong and that's why I got no answers I will
> be willing to help the proper way.
>
> Cheers,
>
> Offray
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNUs4DAAoJEGiex2828ICw4zYH/RkPbLgE1sz+qyvMjRq8wnrF
> f1Jm5sruLyhcsBS5ZhAwTI5qOcgiDLqkY2643hMjFFgzXcdPfyelm3dySpmjKnSm
> +PAw3ykuU/qGcdCWLJPmoEDi6MktsL5r5UcoSj+vLaKk/yT1druzO6qxFOEnod4q
> 0FgM6IEPSBzpqYnvnJTispErxo3NqErXy5pQSG7ql4UPHtTHcDhgpvB/qF0ctE6+
> HDm7M4wTIA78+eJ0izCUeP9esr3VOPvY461nbo2mr9PExqIdm2ef9E/ejLQ4wcBa
> xKmi8+X9Du2GI0M6bf3+jr4UscFrGB0UQwNVbEqCXEmRpQlhGbOW3uUt02U6k/8=
> =l4+q
> -END PGP SIGNATURE-


[web2py] Re: session casesensitive urls

2011-02-09 Thread MDSIII
Tried this and it seems to fix the problem. One unified session_id
cookie.  Thanks Massimo.

-Max

On Feb 8, 11:40 am, Massimo Di Pierro 
wrote:
> Good point. I made the now case insensitive in trunk. Please try.
>
> Massimo
>
> On Feb 8, 12:54 pm, connie_codes  wrote:
>
>
>
>
>
>
>
> > It would appear that the session module uses the application (derived
> > from url) as part of the session key. It also seems that it is case
> > sensitive. I am making AJAX requests from my views which include
> > application/controller/functionname if for whatever reason a user
> > starts their session with any upper-case characters in the application
> > portion of the URL, the function called through AJAX is unable to
> > access their session information and winds up failing. Has anybody
> > else experienced this? Are there any workarounds?
>
> > Thanks for any input


Re: [web2py] Re: Crud formstyle perhaps?

2011-02-09 Thread Lucas D'Avila
Forgot to say this, but i think you can apply the example of the post also
in crud.* forms or FORM ()

--

Lucas D'Avila
http://flavors.me/lucasdavila
Em 09/02/2011 17:15, "greenpoise"  escreveu:


[web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Massimo Di Pierro
Replace


block_access=A(T('block access'),_href=URL(r=request,c='default',
f='block_access'))

with


block_access=BUTTON(T('block access'),_onclick="ajax('%s',[],null);" %
URL('block_access'))

Mind this will only block login, not users already logged-in, unless
you also clear session.

On Feb 9, 11:39 am, Richard Vézina 
wrote:
> Hello,
>
> I would create button to block or unblock user access, so I made those
> function :
>
> def block_access():
>     """
>     UPDATE auth_user
>     SET registration_key='blocked'
>     WHERE auth_user.registration_key = ''
>       AND auth_user.email <> 'myem...@mydomain.com'
>     """
>     db((db.auth_user.registration_key == '') & (db.auth_user.email != '
> myem...@mydomain.com')).update(registration_key='blocked')
>     db.commit()
>
> def unblock_access():
>     """
>     UPDATE auth_user
>     SET registration_key=''
>     WHERE auth_user.registration_key <> 'pending'
>     """
>     db(db.auth_user.registration_key !=
> 'pending').update(registration_key='')
>     db.commit()
>
> Now I would call those function from a link or a button from index or admin
> dashboard...
>
> I would know if there is a other way except this :
>
> def index():
>     block_access=A(T('block access'),_href=URL(r=request,c='default',
> f='block_access'))
>     unblock_access=A(T('unblock access'),_href=URL(r=request,c='default',
> f='unblock_access'))
>     return dict(block_access=block_access, unblock_access=unblock_access)
>
> Since I will need to modify the block and unblock function like this :
>
> def block_access():
>     """
>     UPDATE auth_user
>     SET registration_key='blocked'
>     WHERE auth_user.registration_key = ''
>       AND auth_user.email <> 'myem...@mydomain.com'
>     """
>     db((db.auth_user.registration_key == '') & (db.auth_user.email != '
> myem...@mydomain.com')).update(registration_key='blocked')
>     db.commit()
>     redirect(URL(r=request,c='default', f='index'))
>
> Is there an other way by not utilising redirection?
>
> Thanks
>
> Richard


[web2py] Re: Book needs to be updated

2011-02-09 Thread Massimo Di Pierro
It is copyright but you can ask permission for specific paragraphs and
will probably say yes. ;-)

On Feb 9, 1:19 pm, pbreit  wrote:
> Is the book content copyrighted? Is it possible to incorporate portions into
> other docs?


[web2py] Re: Setting the title tag

2011-02-09 Thread Massimo Di Pierro
You may want to look into blocks: {{block name}}{{end}}

On Feb 9, 12:50 pm, Lorin Rivers  wrote:
> One of the mental challenges I have with mvc/layout approach is how to assign 
> values from the "inside-out". Almost all the work I have done so far is in 
> the views.
>
> I'd like to dynamically change the title tag (e.g.,  in the  
> element).
>
> How does that work?
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)
>
>  smime.p7s
> 6KViewDownload


[web2py] Re: web2py is running on dotCloud

2011-02-09 Thread pbreit
I'm working in the same office as DotCloud so can relay any feedback you 
have. Good group.

[web2py] Coding Dojo

2011-02-09 Thread contatogilson...@gmail.com
Como expliquei no email anterior, o coordenador da UNEB disponibilizou o
local e os materiais (projetor + computador) para o encontro. Antes de mais,
nada, o formulário de inscrição que foi disponibilizado, tem o total de 25
inscritos da comunidade.

Isso extrapola o limite recomendado de um Coding Dojo (que é de 15 a 17
pessoas). Além disso, o coordenador nos deu uma condição para aceitar o
nosso encontro: que os alunos podessem participar (se quiserem).

Então, o número de participantes vai aumentar, e com isso queria expor
algumas coisas:

1 - Essa é uma ótima oportunidade de divulgarmos a linguagem Python nas
faculdades (como na UNEB), sendo que isso é um dos princípios desse  grupos;

2 - Temos a escolha de aceitarmos ou não essa condição, mas sabendo que o
evento vai ser cancelado por falta de local adequado;

Sinceramente, não queria cancelar, porque seria uma forma de reunirmos e
praticarmos, além de juntar todos e nos conhecermos. O que proponho:

1 - Dependendo da quantidade de inscritos, dividir em grupos de 15 pessoas;
2 - Cada grupo estará em uma sala (com projetor + computador), além de um
couch, para coordenar o Dojo para seguirem as regras e não sairem do
propósito: resolver o desafio proposto dentro do horário;
3 - Os alunos que souberem Python (pelo menos o básico) vão participar, caso
contrário vão somente acompanhar;
4 - Os Dojo irão acontecer simultaneamente.

O que precisamos até então é de pessoas (da comunidade) que disponham em
serem couch, para que cada encontro seja organizado. Com isso quero saber
com quem posso contar para ser couch nesse encontro?

Att,

_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


[web2py] will jQuery UI work with web2py?

2011-02-09 Thread Panupat
The latest jQuery UI (1.8.9) says it supports jQuery 1.3.2+. Seeing
that web2py comes with jQuery 1.4.4, will jQuery UI work with this
version?


Re: [web2py] will jQuery UI work with web2py?

2011-02-09 Thread Tom Atkins
Yes it will work. (1.3.2+ means that version and any version higher)

On 9 February 2011 19:40, Panupat  wrote:

> The latest jQuery UI (1.8.9) says it supports jQuery 1.3.2+. Seeing
> that web2py comes with jQuery 1.4.4, will jQuery UI work with this
> version?


Re: [web2py] will jQuery UI work with web2py?

2011-02-09 Thread contatogilson...@gmail.com
Example with jQuery UI - http://gilsondev.com/marcado/

User: admin
Password: admin123
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/2/9 Tom Atkins 

> Yes it will work. (1.3.2+ means that version and any version higher)
>
>
> On 9 February 2011 19:40, Panupat  wrote:
>
>> The latest jQuery UI (1.8.9) says it supports jQuery 1.3.2+. Seeing
>> that web2py comes with jQuery 1.4.4, will jQuery UI work with this
>> version?
>
>
>


Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Richard Vézina
BUTTON Helper do not appear in the book actually...

Richard

On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Replace
>
>
> block_access=A(T('block access'),_href=URL(r=request,c='default',
> f='block_access'))
>
> with
>
>
> block_access=BUTTON(T('block access'),_onclick="ajax('%s',[],null);" %
> URL('block_access'))
>
> Mind this will only block login, not users already logged-in, unless
> you also clear session.
>
> On Feb 9, 11:39 am, Richard Vézina 
> wrote:
> > Hello,
> >
> > I would create button to block or unblock user access, so I made those
> > function :
> >
> > def block_access():
> > """
> > UPDATE auth_user
> > SET registration_key='blocked'
> > WHERE auth_user.registration_key = ''
> >   AND auth_user.email <> 'myem...@mydomain.com'
> > """
> > db((db.auth_user.registration_key == '') & (db.auth_user.email != '
> > myem...@mydomain.com')).update(registration_key='blocked')
> > db.commit()
> >
> > def unblock_access():
> > """
> > UPDATE auth_user
> > SET registration_key=''
> > WHERE auth_user.registration_key <> 'pending'
> > """
> > db(db.auth_user.registration_key !=
> > 'pending').update(registration_key='')
> > db.commit()
> >
> > Now I would call those function from a link or a button from index or
> admin
> > dashboard...
> >
> > I would know if there is a other way except this :
> >
> > def index():
> > block_access=A(T('block access'),_href=URL(r=request,c='default',
> > f='block_access'))
> > unblock_access=A(T('unblock access'),_href=URL(r=request,c='default',
> > f='unblock_access'))
> > return dict(block_access=block_access, unblock_access=unblock_access)
> >
> > Since I will need to modify the block and unblock function like this :
> >
> > def block_access():
> > """
> > UPDATE auth_user
> > SET registration_key='blocked'
> > WHERE auth_user.registration_key = ''
> >   AND auth_user.email <> 'myem...@mydomain.com'
> > """
> > db((db.auth_user.registration_key == '') & (db.auth_user.email != '
> > myem...@mydomain.com')).update(registration_key='blocked')
> > db.commit()
> > redirect(URL(r=request,c='default', f='index'))
> >
> > Is there an other way by not utilising redirection?
> >
> > Thanks
> >
> > Richard
>


[web2py] Re: Setting the title tag

2011-02-09 Thread DenesL
I am not sure what you want to do.
Usually response.title is set in the controller.
If you want to do it in the view you would have to set it before the
extend:

{{response.title='not very dynamic'}}
{{extend 'layout.html'}}
...

Note that you can use your own layout.html, even name it differently.
Have a look in layout.html and see how title is set.

For blocks to work you would also need blocks in the layout, for
example copy layout.html as layout2.html and add the block-end pair as
shown:

{{block mytitle}}
{{=response.title or request.application}}
{{end}}

and in your view:

{{extend 'layout2.html'}}
{{block mytitle}}
not very dynamic
{{end}}



On Feb 9, 2:16 pm, Lorin Rivers  wrote:
> OK, I'm getting there.
>
> How do I specify response.title in my view?
>
> On Feb 9, 2011, at 12:55 PM, DenesL wrote:
>
>
>
> > If you are using the default layout.html file then just set
> > response.title to whatever title you want.
>
> > On Feb 9, 1:50 pm, Lorin Rivers  wrote:
> >> One of the mental challenges I have with mvc/layout approach is how to 
> >> assign values from the "inside-out". Almost all the work I have done so 
> >> far is in the views.
>
> >> I'd like to dynamically change the title tag (e.g.,  in the  
> >> element).
>
> >> How does that work?
> >> --
> >> Lorin Rivers
> >> Mosasaur: Killer Technical Marketing 
> >> 
> >> 512/203.3198 (m)
>
> >>  smime.p7s
> >> 6KViewDownload
>
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)
>
>  smime.p7s
> 6KViewDownload


Re: [web2py] Re: Setting the title tag

2011-02-09 Thread Lorin Rivers
Denes,

I'm a little dense. You sent me down the right path and I just had to struggle 
with it a little.

I didn't realize you could simply build response.title in in the controller and 
it "just works".

Then I had to unroll the tuple I built.

It's all good now, though! Thanks!

In case someone stumbles upon this thread, here's what I did:

controller:
theTitle = ctab.title, str(timestart), "to", str(timeend)
response.title = " ".join(theTitle)

layout.html:
{{=response.title or URL()}}

-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Richard Vézina
BUTTON not working, but it works without redirection with A(T('block
access'),_onclick="ajax('%s',[],null);" %
URL('block_access'))... I don't think that it validate with no _href... With
_href='' it seems to point on default/index

Richard

On Wed, Feb 9, 2011 at 2:49 PM, Richard Vézina
wrote:

> BUTTON Helper do not appear in the book actually...
>
> Richard
>
>
> On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> Replace
>>
>>
>> block_access=A(T('block access'),_href=URL(r=request,c='default',
>> f='block_access'))
>>
>> with
>>
>>
>> block_access=BUTTON(T('block access'),_onclick="ajax('%s',[],null);" %
>> URL('block_access'))
>>
>> Mind this will only block login, not users already logged-in, unless
>> you also clear session.
>>
>> On Feb 9, 11:39 am, Richard Vézina 
>> wrote:
>> > Hello,
>> >
>> > I would create button to block or unblock user access, so I made those
>> > function :
>> >
>> > def block_access():
>> > """
>> > UPDATE auth_user
>> > SET registration_key='blocked'
>> > WHERE auth_user.registration_key = ''
>> >   AND auth_user.email <> 'myem...@mydomain.com'
>> > """
>> > db((db.auth_user.registration_key == '') & (db.auth_user.email != '
>> > myem...@mydomain.com')).update(registration_key='blocked')
>> > db.commit()
>> >
>> > def unblock_access():
>> > """
>> > UPDATE auth_user
>> > SET registration_key=''
>> > WHERE auth_user.registration_key <> 'pending'
>> > """
>> > db(db.auth_user.registration_key !=
>> > 'pending').update(registration_key='')
>> > db.commit()
>> >
>> > Now I would call those function from a link or a button from index or
>> admin
>> > dashboard...
>> >
>> > I would know if there is a other way except this :
>> >
>> > def index():
>> > block_access=A(T('block access'),_href=URL(r=request,c='default',
>> > f='block_access'))
>> > unblock_access=A(T('unblock
>> access'),_href=URL(r=request,c='default',
>> > f='unblock_access'))
>> > return dict(block_access=block_access,
>> unblock_access=unblock_access)
>> >
>> > Since I will need to modify the block and unblock function like this :
>> >
>> > def block_access():
>> > """
>> > UPDATE auth_user
>> > SET registration_key='blocked'
>> > WHERE auth_user.registration_key = ''
>> >   AND auth_user.email <> 'myem...@mydomain.com'
>> > """
>> > db((db.auth_user.registration_key == '') & (db.auth_user.email != '
>> > myem...@mydomain.com')).update(registration_key='blocked')
>> > db.commit()
>> > redirect(URL(r=request,c='default', f='index'))
>> >
>> > Is there an other way by not utilising redirection?
>> >
>> > Thanks
>> >
>> > Richard
>>
>
>


Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Richard Vézina
Get it to work like this in view.py :

{{=T('block
access')}}

Thanks Massimo

Is BUTTON helper in trunk??

Richard

On Wed, Feb 9, 2011 at 3:17 PM, Richard Vézina
wrote:

> BUTTON not working, but it works without redirection with A(T('block
> access'),_onclick="ajax('%s',[],null);" %
> URL('block_access'))... I don't think that it validate with no _href...
> With _href='' it seems to point on default/index
>
> Richard
>
>
> On Wed, Feb 9, 2011 at 2:49 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> BUTTON Helper do not appear in the book actually...
>>
>> Richard
>>
>>
>> On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> Replace
>>>
>>>
>>> block_access=A(T('block access'),_href=URL(r=request,c='default',
>>> f='block_access'))
>>>
>>> with
>>>
>>>
>>> block_access=BUTTON(T('block access'),_onclick="ajax('%s',[],null);" %
>>> URL('block_access'))
>>>
>>> Mind this will only block login, not users already logged-in, unless
>>> you also clear session.
>>>
>>> On Feb 9, 11:39 am, Richard Vézina 
>>> wrote:
>>> > Hello,
>>> >
>>> > I would create button to block or unblock user access, so I made those
>>> > function :
>>> >
>>> > def block_access():
>>> > """
>>> > UPDATE auth_user
>>> > SET registration_key='blocked'
>>> > WHERE auth_user.registration_key = ''
>>> >   AND auth_user.email <> 'myem...@mydomain.com'
>>> > """
>>> > db((db.auth_user.registration_key == '') & (db.auth_user.email != '
>>> > myem...@mydomain.com')).update(registration_key='blocked')
>>> > db.commit()
>>> >
>>> > def unblock_access():
>>> > """
>>> > UPDATE auth_user
>>> > SET registration_key=''
>>> > WHERE auth_user.registration_key <> 'pending'
>>> > """
>>> > db(db.auth_user.registration_key !=
>>> > 'pending').update(registration_key='')
>>> > db.commit()
>>> >
>>> > Now I would call those function from a link or a button from index or
>>> admin
>>> > dashboard...
>>> >
>>> > I would know if there is a other way except this :
>>> >
>>> > def index():
>>> > block_access=A(T('block access'),_href=URL(r=request,c='default',
>>> > f='block_access'))
>>> > unblock_access=A(T('unblock
>>> access'),_href=URL(r=request,c='default',
>>> > f='unblock_access'))
>>> > return dict(block_access=block_access,
>>> unblock_access=unblock_access)
>>> >
>>> > Since I will need to modify the block and unblock function like this :
>>> >
>>> > def block_access():
>>> > """
>>> > UPDATE auth_user
>>> > SET registration_key='blocked'
>>> > WHERE auth_user.registration_key = ''
>>> >   AND auth_user.email <> 'myem...@mydomain.com'
>>> > """
>>> > db((db.auth_user.registration_key == '') & (db.auth_user.email != '
>>> > myem...@mydomain.com')).update(registration_key='blocked')
>>> > db.commit()
>>> > redirect(URL(r=request,c='default', f='index'))
>>> >
>>> > Is there an other way by not utilising redirection?
>>> >
>>> > Thanks
>>> >
>>> > Richard
>>>
>>
>>
>


[web2py] Re: Inform user of registration approval

2011-02-09 Thread bluemoth
I forgot to thank you in my first post. I expected you to be the one
who would answer. I don't know how you answer all these questions.
Thanks very much.

Yes, I had assumed there was no callback for a record change given I
couldn't find anything. I had assumed the way to do it is to create a
controller.

Thanks again.

Cheers, Duane.

On Feb 10, 4:02 am, Massimo Di Pierro 
wrote:


Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread David J.

I was wondering about that too;;

Is BUTTON a new addition?

I didn't see it in the docs;



On 2/9/11 3:24 PM, Richard Vézina wrote:

Get it to work like this in view.py :

{{=T('block 
access')}}


Thanks Massimo

Is BUTTON helper in trunk??

Richard

On Wed, Feb 9, 2011 at 3:17 PM, Richard Vézina 
mailto:ml.richard.vez...@gmail.com>> wrote:


BUTTON not working, but it works without redirection
with A(T('block access'),_onclick="ajax('%s',[],null);" %
URL('block_access'))... I don't think that it validate with no
_href... With _href='' it seems to point on default/index

Richard


On Wed, Feb 9, 2011 at 2:49 PM, Richard Vézina
mailto:ml.richard.vez...@gmail.com>>
wrote:

BUTTON Helper do not appear in the book actually...

Richard


On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro
mailto:massimo.dipie...@gmail.com>> wrote:

Replace


block_access=A(T('block
access'),_href=URL(r=request,c='default',
f='block_access'))

with


block_access=BUTTON(T('block
access'),_onclick="ajax('%s',[],null);" %
URL('block_access'))

Mind this will only block login, not users already
logged-in, unless
you also clear session.

On Feb 9, 11:39 am, Richard Vézina
mailto:ml.richard.vez...@gmail.com>>
wrote:
> Hello,
>
> I would create button to block or unblock user access,
so I made those
> function :
>
> def block_access():
> """
> UPDATE auth_user
> SET registration_key='blocked'
> WHERE auth_user.registration_key = ''
>   AND auth_user.email <> 'myem...@mydomain.com
'
> """
> db((db.auth_user.registration_key == '') &
(db.auth_user.email != '
> myem...@mydomain.com
')).update(registration_key='blocked')
> db.commit()
>
> def unblock_access():
> """
> UPDATE auth_user
> SET registration_key=''
> WHERE auth_user.registration_key <> 'pending'
> """
> db(db.auth_user.registration_key !=
> 'pending').update(registration_key='')
> db.commit()
>
> Now I would call those function from a link or a button
from index or admin
> dashboard...
>
> I would know if there is a other way except this :
>
> def index():
> block_access=A(T('block
access'),_href=URL(r=request,c='default',
> f='block_access'))
> unblock_access=A(T('unblock
access'),_href=URL(r=request,c='default',
> f='unblock_access'))
> return dict(block_access=block_access,
unblock_access=unblock_access)
>
> Since I will need to modify the block and unblock
function like this :
>
> def block_access():
> """
> UPDATE auth_user
> SET registration_key='blocked'
> WHERE auth_user.registration_key = ''
>   AND auth_user.email <> 'myem...@mydomain.com
'
> """
> db((db.auth_user.registration_key == '') &
(db.auth_user.email != '
> myem...@mydomain.com
')).update(registration_key='blocked')
> db.commit()
> redirect(URL(r=request,c='default', f='index'))
>
> Is there an other way by not utilising redirection?
>
> Thanks
>
> Richard








Re: [web2py] Test if client has javascript

2011-02-09 Thread ma...@rockiger.com
The noScript-Tag works, but this way the database-query is executed. I would 
like
to find about javascript in the request of the client.


Re: [web2py] Hosting Web2py on Domain.com

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 11:09 AM, Ahmed Bani  wrote:

> 
> Thanks for the link : http://www.webfaction.com/ ( I will create an account 
> with them soon or later them!). 
> 
> However, following Mr. Jonathanś instructions will help me to learn more 
> about  Web2py.
> 
> Mr. Jonathn, I appreciate your help. I will follow your instructions. Then, I 
> will update everybody about the results of this project. 
> 

Yes, please do. I tried it a year or two ago and it seemed to work okay. 

webfaction is no doubt a better choice in the long run. 

>  


Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Richard Vézina
I got this error in Chrome Dev tool : Uncaught TypeError: Cannot set
property 'innerHTML' of null

Richard

On Wed, Feb 9, 2011 at 3:29 PM, David J.  wrote:

>  I was wondering about that too;;
>
> Is BUTTON a new addition?
>
> I didn't see it in the docs;
>
>
>
>
> On 2/9/11 3:24 PM, Richard Vézina wrote:
>
> Get it to work like this in view.py :
>
>  {{=T('block
> access')}}
>
>  Thanks Massimo
>
>  Is BUTTON helper in trunk??
>
>  Richard
>
> On Wed, Feb 9, 2011 at 3:17 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> BUTTON not working, but it works without redirection with A(T('block
>> access'),_onclick="ajax('%s',[],null);" %
>> URL('block_access'))... I don't think that it validate with no _href...
>> With _href='' it seems to point on default/index
>>
>>  Richard
>>
>>
>> On Wed, Feb 9, 2011 at 2:49 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> BUTTON Helper do not appear in the book actually...
>>>
>>>  Richard
>>>
>>>
>>> On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro <
>>> massimo.dipie...@gmail.com> wrote:
>>>
 Replace


 block_access=A(T('block access'),_href=URL(r=request,c='default',
 f='block_access'))

  with


 block_access=BUTTON(T('block access'),_onclick="ajax('%s',[],null);" %
 URL('block_access'))

 Mind this will only block login, not users already logged-in, unless
 you also clear session.

 On Feb 9, 11:39 am, Richard Vézina 
 wrote:
 > Hello,
 >
 > I would create button to block or unblock user access, so I made those
 > function :
 >
 > def block_access():
 > """
 > UPDATE auth_user
 > SET registration_key='blocked'
 > WHERE auth_user.registration_key = ''
  >   AND auth_user.email <> 'myem...@mydomain.com'
 > """
 > db((db.auth_user.registration_key == '') & (db.auth_user.email !=
 '
  > myem...@mydomain.com')).update(registration_key='blocked')
 > db.commit()
 >
 > def unblock_access():
 > """
 > UPDATE auth_user
 > SET registration_key=''
 > WHERE auth_user.registration_key <> 'pending'
 > """
 > db(db.auth_user.registration_key !=
 > 'pending').update(registration_key='')
 > db.commit()
 >
 > Now I would call those function from a link or a button from index or
 admin
 > dashboard...
 >
 > I would know if there is a other way except this :
 >
 > def index():
 > block_access=A(T('block access'),_href=URL(r=request,c='default',
 > f='block_access'))
 > unblock_access=A(T('unblock
 access'),_href=URL(r=request,c='default',
 > f='unblock_access'))
 > return dict(block_access=block_access,
 unblock_access=unblock_access)
 >
 > Since I will need to modify the block and unblock function like this :
 >
 > def block_access():
 > """
 > UPDATE auth_user
 > SET registration_key='blocked'
 > WHERE auth_user.registration_key = ''
  >   AND auth_user.email <> 'myem...@mydomain.com'
 > """
 > db((db.auth_user.registration_key == '') & (db.auth_user.email !=
 '
  > myem...@mydomain.com')).update(registration_key='blocked')
  > db.commit()
 > redirect(URL(r=request,c='default', f='index'))
 >
 > Is there an other way by not utilising redirection?
 >
 > Thanks
 >
 > Richard

>>>
>>>
>>
>
>


Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Richard Vézina
It is around this line in rendered html :

  jQuery.ajax({type: "POST", url: u, data: query, success: function(msg) {
if(t==':eval') eval(msg); else document.getElementById(t).innerHTML=msg; }
});
}

Richard

On Wed, Feb 9, 2011 at 3:38 PM, Richard Vézina
wrote:

> I got this error in Chrome Dev tool : Uncaught TypeError: Cannot set
> property 'innerHTML' of null
>
> Richard
>
>
> On Wed, Feb 9, 2011 at 3:29 PM, David J.  wrote:
>
>>  I was wondering about that too;;
>>
>> Is BUTTON a new addition?
>>
>> I didn't see it in the docs;
>>
>>
>>
>>
>> On 2/9/11 3:24 PM, Richard Vézina wrote:
>>
>> Get it to work like this in view.py :
>>
>>  {{=T('block
>> access')}}
>>
>>  Thanks Massimo
>>
>>  Is BUTTON helper in trunk??
>>
>>  Richard
>>
>> On Wed, Feb 9, 2011 at 3:17 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> BUTTON not working, but it works without redirection with A(T('block
>>> access'),_onclick="ajax('%s',[],null);" %
>>> URL('block_access'))... I don't think that it validate with no _href...
>>> With _href='' it seems to point on default/index
>>>
>>>  Richard
>>>
>>>
>>> On Wed, Feb 9, 2011 at 2:49 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 BUTTON Helper do not appear in the book actually...

  Richard


 On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro <
 massimo.dipie...@gmail.com> wrote:

> Replace
>
>
> block_access=A(T('block access'),_href=URL(r=request,c='default',
> f='block_access'))
>
>  with
>
>
> block_access=BUTTON(T('block access'),_onclick="ajax('%s',[],null);" %
> URL('block_access'))
>
> Mind this will only block login, not users already logged-in, unless
> you also clear session.
>
> On Feb 9, 11:39 am, Richard Vézina 
> wrote:
> > Hello,
> >
> > I would create button to block or unblock user access, so I made
> those
> > function :
> >
> > def block_access():
> > """
> > UPDATE auth_user
> > SET registration_key='blocked'
> > WHERE auth_user.registration_key = ''
>  >   AND auth_user.email <> 'myem...@mydomain.com'
> > """
> > db((db.auth_user.registration_key == '') & (db.auth_user.email !=
> '
>  > myem...@mydomain.com')).update(registration_key='blocked')
> > db.commit()
> >
> > def unblock_access():
> > """
> > UPDATE auth_user
> > SET registration_key=''
> > WHERE auth_user.registration_key <> 'pending'
> > """
> > db(db.auth_user.registration_key !=
> > 'pending').update(registration_key='')
> > db.commit()
> >
> > Now I would call those function from a link or a button from index or
> admin
> > dashboard...
> >
> > I would know if there is a other way except this :
> >
> > def index():
> > block_access=A(T('block access'),_href=URL(r=request,c='default',
> > f='block_access'))
> > unblock_access=A(T('unblock
> access'),_href=URL(r=request,c='default',
> > f='unblock_access'))
> > return dict(block_access=block_access,
> unblock_access=unblock_access)
> >
> > Since I will need to modify the block and unblock function like this
> :
> >
> > def block_access():
> > """
> > UPDATE auth_user
> > SET registration_key='blocked'
> > WHERE auth_user.registration_key = ''
>  >   AND auth_user.email <> 'myem...@mydomain.com'
> > """
> > db((db.auth_user.registration_key == '') & (db.auth_user.email !=
> '
>  > myem...@mydomain.com')).update(registration_key='blocked')
>  > db.commit()
> > redirect(URL(r=request,c='default', f='index'))
> >
> > Is there an other way by not utilising redirection?
> >
> > Thanks
> >
> > Richard
>


>>>
>>
>>
>


Re: [web2py] Trying to use a plugin_wiki page as default for a web2py site

2011-02-09 Thread Anthony
Hi Offray,
 
I haven't used plugin_wiki, and I'm no routes expert, so I'm sure someone 
else can provide more detailed help, but this should get you started.
 
When you have a plugin_wiki URL like this:
 
http://127.0.0.1:8000/myapp/plugin_wiki/page/test
 
'page' is the function in the 'plugin_wiki' controller, and 'test' is an 
argument in request.args. 'test' does not get passed to 'page' as a function 
argument -- rather, 'test' is available to the 'page' function via the 
global 'request' object (i.e., in request.args). You can see this in the 
plugin_wiki source code: 
http://code.google.com/p/cube2py/source/browse/controllers/plugin_wiki.py#24. 
So, you can't do 'page(test)' as you first tried, since 'page' does not 
accept arguments. Instead, 'page/test' is the right form, but unfortunately, 
default_function only accepts a function and not request arguments, so you 
can't do default_function = 'page/test' either. I think the only way to do 
what you want is probably to use the routes_in/routes_out functionality 
described here: http://web2py.com/book/default/chapter/04#URL-Rewrite.
 
I'm not sure if this is quite right, but maybe something like:
 
routes_in = ( ('/', '/welcome/plugin_wiki/page/test') )
 
Hope that helps.
 
Best,
Anthony
 

On Monday, February 7, 2011 8:10:15 PM UTC-5, Offray Vladimir Luna Cárdenas 
wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1 
>
> Hi again, 
>
> I have an error: 
>
>
> El 07/02/11 19:58, Offray Vladimir Luna C�rdenas escribi�: 
>
>
> []
> > --->
> > default_application = 'welcome'# ordinarily set in base routes.py
> > default_controller = 'plugin_wiki'  # ordinarily set in app-specific
> > routes.py
> > default_function = 'page'   # ordinarily set in app-specific..
> > <---
> > 
> > and it shows the page for pages creation with all the created ones. If I
> > tryed adding parenthesis to "page" function, making it "page()" and it
> > shows a more specif message for page creation. 
>
>
> > When I tried
> > "page(test)", using a previously created "test" page, web2py send me an
> > error message of the form:
> > 
> > invalid function (plugin_wiki/page(test)) 
>
>
> Is not true (bad memory). default_function = 'index', shows the form
> with all the created pages and default_function = 'page' shows the more
> specific message for a page creation. default_function = 'page()' gives
> the same error message that trying with a specific page name. Also when
> I tried default_funtion = 'page/test' for example. 
>
> Thanks, 
>
> Offray
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ 
>
> iQEcBAEBAgAGBQJNUJf3AAoJEGiex2828ICwb5sH/0QvGsdpnhM2JUwJiepTPeLo
> puNNTOyXrhaifpuW21BEBnVVgyEjfEtRo/vJrlF8lDGZ3eacxCr0WoR5lSWpnkcT
> TKYy8lCb2CrW/BuwBHaPsX3qZVjvLGBm7SyxiS0pD+jj4xgBiGqiQmIcabSjs82s
> HBwEkeChbakAmOG2R8W6TW30J0VdVsgfDRiI/zdJ4O48ffT4s1LlhKApPn9VFlt7
> CKhox9it/4aFMMpzmrjEtgyL+Gc4zJmx1KKhTYrRnKniC5TA91jX5HqhUKlFuXHT
> 2OX3mBpkL0rdqoy21aus0/TATDazf32I/Z/yC52/EAgOD4MsF0R+ivd9q6iZ0cg=
> =5CZF
> -END PGP SIGNATURE-
>
>   

Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread Richard Vézina
Base on this post it seems a chrome issue that could be fixed as explained
in the first response :

http://www.google.com/support/forum/p/Chrome/thread?tid=4861d2b2c6c2a96a&hl=en


Richard

On Wed, Feb 9, 2011 at 3:39 PM, Richard Vézina
wrote:

> It is around this line in rendered html :
>
>   jQuery.ajax({type: "POST", url: u, data: query, success: function(msg) {
> if(t==':eval') eval(msg); else document.getElementById(t).innerHTML=msg; }
> });
> }
>
> Richard
>
> On Wed, Feb 9, 2011 at 3:38 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I got this error in Chrome Dev tool : Uncaught TypeError: Cannot set
>> property 'innerHTML' of null
>>
>> Richard
>>
>>
>> On Wed, Feb 9, 2011 at 3:29 PM, David J.  wrote:
>>
>>>  I was wondering about that too;;
>>>
>>> Is BUTTON a new addition?
>>>
>>> I didn't see it in the docs;
>>>
>>>
>>>
>>>
>>> On 2/9/11 3:24 PM, Richard Vézina wrote:
>>>
>>> Get it to work like this in view.py :
>>>
>>>  {{=T('block
>>> access')}}
>>>
>>>  Thanks Massimo
>>>
>>>  Is BUTTON helper in trunk??
>>>
>>>  Richard
>>>
>>> On Wed, Feb 9, 2011 at 3:17 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 BUTTON not working, but it works without redirection with A(T('block
 access'),_onclick="ajax('%s',[],null);" %
 URL('block_access'))... I don't think that it validate with no _href...
 With _href='' it seems to point on default/index

  Richard


 On Wed, Feb 9, 2011 at 2:49 PM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> BUTTON Helper do not appear in the book actually...
>
>  Richard
>
>
> On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> Replace
>>
>>
>> block_access=A(T('block access'),_href=URL(r=request,c='default',
>> f='block_access'))
>>
>>  with
>>
>>
>> block_access=BUTTON(T('block access'),_onclick="ajax('%s',[],null);" %
>> URL('block_access'))
>>
>> Mind this will only block login, not users already logged-in, unless
>> you also clear session.
>>
>> On Feb 9, 11:39 am, Richard Vézina 
>> wrote:
>> > Hello,
>> >
>> > I would create button to block or unblock user access, so I made
>> those
>> > function :
>> >
>> > def block_access():
>> > """
>> > UPDATE auth_user
>> > SET registration_key='blocked'
>> > WHERE auth_user.registration_key = ''
>>  >   AND auth_user.email <> 'myem...@mydomain.com'
>> > """
>> > db((db.auth_user.registration_key == '') & (db.auth_user.email
>> != '
>>  > myem...@mydomain.com')).update(registration_key='blocked')
>> > db.commit()
>> >
>> > def unblock_access():
>> > """
>> > UPDATE auth_user
>> > SET registration_key=''
>> > WHERE auth_user.registration_key <> 'pending'
>> > """
>> > db(db.auth_user.registration_key !=
>> > 'pending').update(registration_key='')
>> > db.commit()
>> >
>> > Now I would call those function from a link or a button from index
>> or admin
>> > dashboard...
>> >
>> > I would know if there is a other way except this :
>> >
>> > def index():
>> > block_access=A(T('block
>> access'),_href=URL(r=request,c='default',
>> > f='block_access'))
>> > unblock_access=A(T('unblock
>> access'),_href=URL(r=request,c='default',
>> > f='unblock_access'))
>> > return dict(block_access=block_access,
>> unblock_access=unblock_access)
>> >
>> > Since I will need to modify the block and unblock function like this
>> :
>> >
>> > def block_access():
>> > """
>> > UPDATE auth_user
>> > SET registration_key='blocked'
>> > WHERE auth_user.registration_key = ''
>>  >   AND auth_user.email <> 'myem...@mydomain.com'
>> > """
>> > db((db.auth_user.registration_key == '') & (db.auth_user.email
>> != '
>>  > myem...@mydomain.com')).update(registration_key='blocked')
>>  > db.commit()
>> > redirect(URL(r=request,c='default', f='index'))
>> >
>> > Is there an other way by not utilising redirection?
>> >
>> > Thanks
>> >
>> > Richard
>>
>
>

>>>
>>>
>>
>


[web2py] Re: Trying to use a plugin_wiki page as default for a web2py site

2011-02-09 Thread villas
If routes are a problem,  then one idea is to simply create a wiki
page named for example 'home' and then alter the default controller
index function:

def index():
redirect(URL(c='plugin_wiki',f='home'))



On Feb 8, 12:58 am, Offray Vladimir Luna Cárdenas 
wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> I'm trying to use plugin_wiki as my first approach to having a
> functional web2py site and using it to publish easily some info. I tried
> also Instant Press but it doesn't installed because a time out error a
> got no feedback on the Spanish or English list and I would like to test
> more plugin_wiki for a more techie approach to publishing in web2py even
> making a blog on it (but I plan to go to Instant Press again for some
> not technical inclined friends who I want to introduce to web2py).
>
> Anyway I'm trying to make a page in plugin_wiki a default page when
> people load the web2py powered site, so I modified the routes.example.py
> naming it routes.py and restarted cherokee. My change was this:
>
> - --->
> default_application = 'welcome'    # ordinarily set in base routes.py
> default_controller = 'plugin_wiki'  # ordinarily set in app-specific
> routes.py
> default_function = 'page'   # ordinarily set in app-specific..
> <---
>
> and it shows the page for pages creation with all the created ones. If I
> tryed adding parenthesis to "page" function, making it "page()" and it
> shows a more specif message for page creation. When I tried
> "page(test)", using a previously created "test" page, web2py send me an
> error message of the form:
>
> invalid function (plugin_wiki/page(test))
>
> May be I'm understanding wrong about how to use routes.py or calling a
> specific pages as an argument of page function. Any advice about how to
> make a specific plugin_wiki default home page will be appreciated.
>
> Thanks in advance,
>
> Offray
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNUJUvAAoJEGiex2828ICwAQUH/jDyi+ppJ/B35IJqeHfp8VGK
> wpOhXLRldBqq2UfEQJfnR1YqIRYAeJX2kgGuyo0A4L8emF+ELeld1/de86R51E/2
> M+IvMTtovfoCfA0mQf+hiHQU/vHLgX+IEv6LPJXvvSK2BoFnNq5mT9Fs9LA/ukdv
> 3x8Vor5jfANW9CHEndDZzUf34UrB0ZkmPJSYyOypkpdOvoVP/vzufBmWwbE1G1n5
> lhusdbdauHagiKDx9ZpnvKXduMQSeX2yWbAreo59mUaaQ+w4jGUwx+vUAXZDqik8
> NoleBeGsCXvuQzYH4RZCg0cG43ODI/K6o24v/mrB/dTdEKgg0wOPwopOkg5ZuOA=
> =ZiUF
> -END PGP SIGNATURE-


[web2py] Re: Trying to use a plugin_wiki page as default for a web2py site

2011-02-09 Thread Massimo Di Pierro
should be

def index():
    redirect(URL('plugin_wiki','page',args='home'))

On Feb 9, 3:04 pm, villas  wrote:
> If routes are a problem,  then one idea is to simply create a wiki
> page named for example 'home' and then alter the default controller
> index function:
>
> def index():
>     redirect(URL(c='plugin_wiki',f='home'))
>
> On Feb 8, 12:58 am, Offray Vladimir Luna Cárdenas 
> wrote:
>
>
>
>
>
>
>
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
>
> > Hi all,
>
> > I'm trying to use plugin_wiki as my first approach to having a
> > functional web2py site and using it to publish easily some info. I tried
> > also Instant Press but it doesn't installed because a time out error a
> > got no feedback on the Spanish or English list and I would like to test
> > more plugin_wiki for a more techie approach to publishing in web2py even
> > making a blog on it (but I plan to go to Instant Press again for some
> > not technical inclined friends who I want to introduce to web2py).
>
> > Anyway I'm trying to make a page in plugin_wiki a default page when
> > people load the web2py powered site, so I modified the routes.example.py
> > naming it routes.py and restarted cherokee. My change was this:
>
> > - --->
> > default_application = 'welcome'    # ordinarily set in base routes.py
> > default_controller = 'plugin_wiki'  # ordinarily set in app-specific
> > routes.py
> > default_function = 'page'   # ordinarily set in app-specific..
> > <---
>
> > and it shows the page for pages creation with all the created ones. If I
> > tryed adding parenthesis to "page" function, making it "page()" and it
> > shows a more specif message for page creation. When I tried
> > "page(test)", using a previously created "test" page, web2py send me an
> > error message of the form:
>
> > invalid function (plugin_wiki/page(test))
>
> > May be I'm understanding wrong about how to use routes.py or calling a
> > specific pages as an argument of page function. Any advice about how to
> > make a specific plugin_wiki default home page will be appreciated.
>
> > Thanks in advance,
>
> > Offray
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.11 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> > iQEcBAEBAgAGBQJNUJUvAAoJEGiex2828ICwAQUH/jDyi+ppJ/B35IJqeHfp8VGK
> > wpOhXLRldBqq2UfEQJfnR1YqIRYAeJX2kgGuyo0A4L8emF+ELeld1/de86R51E/2
> > M+IvMTtovfoCfA0mQf+hiHQU/vHLgX+IEv6LPJXvvSK2BoFnNq5mT9Fs9LA/ukdv
> > 3x8Vor5jfANW9CHEndDZzUf34UrB0ZkmPJSYyOypkpdOvoVP/vzufBmWwbE1G1n5
> > lhusdbdauHagiKDx9ZpnvKXduMQSeX2yWbAreo59mUaaQ+w4jGUwx+vUAXZDqik8
> > NoleBeGsCXvuQzYH4RZCg0cG43ODI/K6o24v/mrB/dTdEKgg0wOPwopOkg5ZuOA=
> > =ZiUF
> > -END PGP SIGNATURE-


Re: [web2py] Re: URL secure flag.

2011-02-09 Thread howesc
good, bad, or indifferent, because of varied testing and deployment setups, 
and using multiple ports, i have the function below in my app.  note that i 
have database configuration for HTTPS scheme and port.  It's my hack not not 
run internal test and development servers on port 443. :)

def full_url(scheme="http",
a=None,
c=None,
f=None,
r=None,
args=[],
vars={},
anchor='',
path = None
):
"""
Create a fully qualified URL.  The URL will use the same host as the
request was made from, but will use the specified scheme.  Calls
C{gluon.html.URL()} to construct the relative path to the host.

if _port is set in the settings table, append the port to the
domain of the created URL

@param scheme: scheme to use for the fully-qualified URL.
   (default to 'http')
@param a: application (default to current if r is given)
@param c: controller (default to current if r is given)
@param f: function (default to current if r is given)
@param r: request
@param args: any arguments (optional)
@param vars: any variables (optional)
@param anchor: anchorname, without # (optional)
@param path: the relative path to use.  if used overrides a,c,f,args, 
and
  vars (optional)
"""
port = ''
if sitesettings.has_key(scheme+"_port") and 
sitesettings[scheme+"_port"]:
port = ":" + sitesettings[scheme+"_port"]
if scheme == 'https' and sitesettings.has_key("https_scheme"):
scheme = sitesettings.https_scheme
url = scheme +'://' + \
r.env.http_host.split(':')[0] + port
if path:
url = url + path
else:
url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, 
anchor=anchor)
return url



[web2py] Re: plugin_wiki suggestions

2011-02-09 Thread villas
Massimo,
Regarding the problem with the reserved SQL words, I entered it as an
issue on cube2py (issue 6).
Regards, D

On Feb 9, 3:17 pm, Massimo Di Pierro 
wrote:
> It is in google code, inside the example app:
>
> http://code.google.com/p/cube2py/
>
> On Feb 9, 8:36 am, blackthorne  wrote:
>
> > Would you consider the idea of putting plugin_wiki source code in a
> > (git?) repository for versioning?
>
> > On Feb 7, 2:26 pm, Massimo Di Pierro 
> > wrote:
>
> > > If you are in mode 3 (code allowed) you can do ``{{=response.title}}
> > > ``:template
>
> > > On Feb 7, 12:29 am, Plumo  wrote:
>
> > > > I also made this change to set the page title.
>
> > > > How can I access the page title from within a wiki page?
> > > > response.title is empty
>
>


Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 1:24 PM, howesc wrote:
> good, bad, or indifferent, because of varied testing and deployment setups, 
> and using multiple ports, i have the function below in my app.  note that i 
> have database configuration for HTTPS scheme and port.  It's my hack not not 
> run internal test and development servers on port 443. :)

Thanks. I'd forgotten about port; I'll add that as well.

> 
> def full_url(scheme="http",
> a=None,
> c=None,
> f=None,
> r=None,
> args=[],
> vars={},
> anchor='',
> path = None
> ):
> """
> Create a fully qualified URL.  The URL will use the same host as the
> request was made from, but will use the specified scheme.  Calls
> C{gluon.html.URL()} to construct the relative path to the host.
> 
> if _port is set in the settings table, append the port to the
> domain of the created URL
> 
> @param scheme: scheme to use for the fully-qualified URL.
>(default to 'http')
> @param a: application (default to current if r is given)
> @param c: controller (default to current if r is given)
> @param f: function (default to current if r is given)
> @param r: request
> @param args: any arguments (optional)
> @param vars: any variables (optional)
> @param anchor: anchorname, without # (optional)
> @param path: the relative path to use.  if used overrides a,c,f,args, and
>   vars (optional)
> """
> port = ''
> if sitesettings.has_key(scheme+"_port") and sitesettings[scheme+"_port"]:
> port = ":" + sitesettings[scheme+"_port"]
> if scheme == 'https' and sitesettings.has_key("https_scheme"):
> scheme = sitesettings.https_scheme
> url = scheme +'://' + \
> r.env.http_host.split(':')[0] + port
> if path:
> url = url + path
> else:
> url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, anchor=anchor)
> return url
> 




[web2py] Re: Trying to use a plugin_wiki page as default for a web2py site

2011-02-09 Thread villas
On Feb 9, 9:09 pm, Massimo Di Pierro 
wrote:
> should be...

Oops! I should test before posting from memory!
Thanks. D


[web2py] Re: Book needs to be updated

2011-02-09 Thread cjrh
On Feb 9, 9:01 pm, Richard Vézina  wrote:
> We can put a frame around the screenshot... But it will make harder to have
> unity between screenshot if it not the same person that make all of them...

Good idea for frame.  Multiple people can make screenshots (e.g. let's
say Massimo assigns a captain to each chapter, and they manage the
work) but I still say that we must make a special theme/layout to be
used for book screenshots, and the layout/theme must be shared with
all the captains, so that the theming of all the screenshots is
correct.

> Or we can make a script in gimp for cropping.

Sure, that kind of thing is no problem, I would actually prefer to use
PIL over Gimp.


Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Anthony
Do we want to handle websocket URLs as well (i.e., ws and wss 
schemes instead of http and https)?

On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:

> On Feb 9, 2011, at 1:24 PM, howesc wrote:
> > good, bad, or indifferent, because of varied testing and deployment 
> setups, and using multiple ports, i have the function below in my app.  note 
> that i have database configuration for HTTPS scheme and port.  It's my hack 
> not not run internal test and development servers on port 443. :) 
>
> Thanks. I'd forgotten about port; I'll add that as well. 
>
> > 
> > def full_url(scheme="http",
> > a=None,
> > c=None,
> > f=None,
> > r=None,
> > args=[],
> > vars={},
> > anchor='',
> > path = None
> > ):
> > """
> > Create a fully qualified URL.  The URL will use the same host as the
> > request was made from, but will use the specified scheme.  Calls
> > C{gluon.html.URL()} to construct the relative path to the host.
> > 
> > if _port is set in the settings table, append the port to the
> > domain of the created URL
> > 
> > @param scheme: scheme to use for the fully-qualified URL.
> >(default to 'http')
> > @param a: application (default to current if r is given)
> > @param c: controller (default to current if r is given)
> > @param f: function (default to current if r is given)
> > @param r: request
> > @param args: any arguments (optional)
> > @param vars: any variables (optional)
> > @param anchor: anchorname, without # (optional)
> > @param path: the relative path to use.  if used overrides a,c,f,args, 
> and
> >   vars (optional)
> > """
> > port = ''
> > if sitesettings.has_key(scheme+"_port") and 
> sitesettings[scheme+"_port"]:
> > port = ":" + sitesettings[scheme+"_port"]
> > if scheme == 'https' and sitesettings.has_key("https_scheme"):
> > scheme = sitesettings.https_scheme
> > url = scheme +'://' + \
> > r.env.http_host.split(':')[0] + port
> > if path:
> > url = url + path
> > else:
> > url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, 
> anchor=anchor)
> > return url
> > 
>
>
>  

[web2py] Re: simple pyquestion dictionaries

2011-02-09 Thread cjrh
On Feb 9, 5:15 pm, Massimo Di Pierro 
wrote:
> Not in python. It has no tail recursion so it will crash the
> interpreter if you have more than ~1000 terms (depending on how python
> was compiled).

That's an implementation detail!  sys.setrecursionlimit(n) can get you
quite far, however :)

The main problem with using recursion is that most colleagues will be
unable to understand or debug your code.   This is by far the greatest
value consideration, and very few problems justify recursion when
python is so richly packed with intelligent iterators and generous
generators.




[web2py] Re: Book needs to be updated

2011-02-09 Thread Anthony
I'm happy to help. Looks like most of the screenshots include the browser 
chrome -- so, would we all have to being using the same browser on the same 
platform (with no toolbars, etc.) to get a consistent look? I'm on Windows 7 
(IE8, FF3.6, Chrome 9).
 
Anthony

On Wednesday, February 9, 2011 5:18:35 PM UTC-5, cjrh wrote:

> On Feb 9, 9:01 pm, Richard Vézina  wrote: 
> > We can put a frame around the screenshot... But it will make harder to 
> have 
> > unity between screenshot if it not the same person that make all of 
> them... 
>
> Good idea for frame.  Multiple people can make screenshots (e.g. let's 
> say Massimo assigns a captain to each chapter, and they manage the 
> work) but I still say that we must make a special theme/layout to be 
> used for book screenshots, and the layout/theme must be shared with 
> all the captains, so that the theming of all the screenshots is 
> correct. 
>
> > Or we can make a script in gimp for cropping. 
>
> Sure, that kind of thing is no problem, I would actually prefer to use 
> PIL over Gimp. 
>


Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 2:24 PM, Anthony wrote:
> Do we want to handle websocket URLs as well (i.e., ws and wss schemes instead 
> of http and https)?

I don't know. Is there an RFC yet?

I've sent Massimo a patch already, but I could redo it to directly specify 
scheme= instead of secure=, and allow an arbitrary string.

Now would be the time...

> 
> On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:
> On Feb 9, 2011, at 1:24 PM, howesc wrote:
> > good, bad, or indifferent, because of varied testing and deployment setups, 
> > and using multiple ports, i have the function below in my app.  note that i 
> > have database configuration for HTTPS scheme and port.  It's my hack not 
> > not run internal test and development servers on port 443. :)
> Thanks. I'd forgotten about port; I'll add that as well.
> 
> > 
> > def full_url(scheme="http",
> > a=None,
> > c=None,
> > f=None,
> > r=None,
> > args=[],
> > vars={},
> > anchor='',
> > path = None
> > ):
> > """
> > Create a fully qualified URL.  The URL will use the same host as the
> > request was made from, but will use the specified scheme.  Calls
> > C{gluon.html.URL()} to construct the relative path to the host.
> > 
> > if _port is set in the settings table, append the port to the
> > domain of the created URL
> > 
> > @param scheme: scheme to use for the fully-qualified URL.
> >(default to 'http')
> > @param a: application (default to current if r is given)
> > @param c: controller (default to current if r is given)
> > @param f: function (default to current if r is given)
> > @param r: request
> > @param args: any arguments (optional)
> > @param vars: any variables (optional)
> > @param anchor: anchorname, without # (optional)
> > @param path: the relative path to use.  if used overrides a,c,f,args, 
> > and
> >   vars (optional)
> > """
> > port = ''
> > if sitesettings.has_key(scheme+"_port") and 
> > sitesettings[scheme+"_port"]:
> > port = ":" + sitesettings[scheme+"_port"]
> > if scheme == 'https' and sitesettings.has_key("https_scheme"):
> > scheme = sitesettings.https_scheme
> > url = scheme +'://' + \
> > r.env.http_host.split(':')[0] + port
> > if path:
> > url = url + path
> > else:
> > url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, 
> > anchor=anchor)
> > return url
> >
> 
> 
> 
> 
> 




Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:
> On Feb 9, 2011, at 2:24 PM, Anthony wrote:
>> Do we want to handle websocket URLs as well (i.e., ws and wss schemes 
>> instead of http and https)?
> 
> I don't know. Is there an RFC yet?
> 
> I've sent Massimo a patch already, but I could redo it to directly specify 
> scheme= instead of secure=, and allow an arbitrary string.
> 
> Now would be the time...

OK, I made the change. scheme='wss' (for example) works. 

scheme=True uses the scheme from request.env

> 
>> 
>> On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:
>> On Feb 9, 2011, at 1:24 PM, howesc wrote:
>> > good, bad, or indifferent, because of varied testing and deployment 
>> > setups, and using multiple ports, i have the function below in my app.  
>> > note that i have database configuration for HTTPS scheme and port.  It's 
>> > my hack not not run internal test and development servers on port 443. :)
>> Thanks. I'd forgotten about port; I'll add that as well.
>> 
>> > 
>> > def full_url(scheme="http",
>> > a=None,
>> > c=None,
>> > f=None,
>> > r=None,
>> > args=[],
>> > vars={},
>> > anchor='',
>> > path = None
>> > ):
>> > """
>> > Create a fully qualified URL.  The URL will use the same host as the
>> > request was made from, but will use the specified scheme.  Calls
>> > C{gluon.html.URL()} to construct the relative path to the host.
>> > 
>> > if _port is set in the settings table, append the port to the
>> > domain of the created URL
>> > 
>> > @param scheme: scheme to use for the fully-qualified URL.
>> >(default to 'http')
>> > @param a: application (default to current if r is given)
>> > @param c: controller (default to current if r is given)
>> > @param f: function (default to current if r is given)
>> > @param r: request
>> > @param args: any arguments (optional)
>> > @param vars: any variables (optional)
>> > @param anchor: anchorname, without # (optional)
>> > @param path: the relative path to use.  if used overrides a,c,f,args, 
>> > and
>> >   vars (optional)
>> > """
>> > port = ''
>> > if sitesettings.has_key(scheme+"_port") and 
>> > sitesettings[scheme+"_port"]:
>> > port = ":" + sitesettings[scheme+"_port"]
>> > if scheme == 'https' and sitesettings.has_key("https_scheme"):
>> > scheme = sitesettings.https_scheme
>> > url = scheme +'://' + \
>> > r.env.http_host.split(':')[0] + port
>> > if path:
>> > url = url + path
>> > else:
>> > url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, 
>> > anchor=anchor)
>> > return url
>> >
>> 
>> 
>> 
>> 
>> 
> 
> 




Re: [web2py] Re: URL secure flag.

2011-02-09 Thread David J.

So then we would use scheme='https' for secure and forget the secure flag?



On 2/9/11 6:26 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:24 PM, Anthony wrote:
Do we want to handle websocket URLs as well (i.e., ws and wss 
schemes instead of http and https)?


I don't know. Is there an RFC yet?

I've sent Massimo a patch already, but I could redo it to directly 
specify scheme= instead of secure=, and allow an arbitrary string.


Now would be the time...


OK, I made the change. scheme='wss' (for example) works.

scheme=True uses the scheme from request.env





On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:

On Feb 9, 2011, at 1:24 PM, howesc wrote:
> good, bad, or indifferent, because of varied testing and
deployment setups, and using multiple ports, i have the function
below in my app.  note that i have database configuration for
HTTPS scheme and port.  It's my hack not not run internal test
and development servers on port 443. :)

Thanks. I'd forgotten about port; I'll add that as well.

>
> def full_url(scheme="http",
> a=None,
> c=None,
> f=None,
> r=None,
> args=[],
> vars={},
> anchor='',
> path = None
> ):
> """
> Create a fully qualified URL.  The URL will use the same
host as the
> request was made from, but will use the specified scheme.
 Calls
> C{gluon.html.URL()} to construct the relative path to the
host.
>
> if _port is set in the settings table, append the
port to the
> domain of the created URL
>
> @param scheme: scheme to use for the fully-qualified URL.
>(default to 'http')
> @param a: application (default to current if r is given)
> @param c: controller (default to current if r is given)
> @param f: function (default to current if r is given)
> @param r: request
> @param args: any arguments (optional)
> @param vars: any variables (optional)
> @param anchor: anchorname, without # (optional)
> @param path: the relative path to use.  if used overrides
a,c,f,args, and
>   vars (optional)
> """
> port = ''
> if sitesettings.has_key(scheme+"_port") and
sitesettings[scheme+"_port"]:
> port = ":" + sitesettings[scheme+"_port"]
> if scheme == 'https' and sitesettings.has_key("https_scheme"):
> scheme = sitesettings.https_scheme
> url = scheme +'://' + \
> r.env.http_host.split(':')[0] + port
> if path:
> url = url + path
> else:
> url = url+URL(a=a, c=c, f=f, r=r, args=args,
vars=vars, anchor=anchor)
> return url
>














Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 3:34 PM, David J. wrote:
> So then we would use scheme='https' for secure and forget the secure flag?

Right. It's a little more general, since 'secure' could also imply 'wss'.

> 
> 
> 
> On 2/9/11 6:26 PM, Jonathan Lundell wrote:
>> 
>> On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:
>>> On Feb 9, 2011, at 2:24 PM, Anthony wrote:
 Do we want to handle websocket URLs as well (i.e., ws and wss schemes 
 instead of http and https)?
>>> 
>>> I don't know. Is there an RFC yet?
>>> 
>>> I've sent Massimo a patch already, but I could redo it to directly specify 
>>> scheme= instead of secure=, and allow an arbitrary string.
>>> 
>>> Now would be the time...
>> 
>> OK, I made the change. scheme='wss' (for example) works. 
>> 
>> scheme=True uses the scheme from request.env
>> 
>>> 
 
 On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:
 On Feb 9, 2011, at 1:24 PM, howesc wrote:
 > good, bad, or indifferent, because of varied testing and deployment 
 > setups, and using multiple ports, i have the function below in my app.  
 > note that i have database configuration for HTTPS scheme and port.  It's 
 > my hack not not run internal test and development servers on port 443. :)
 Thanks. I'd forgotten about port; I'll add that as well.
 
 > 
 > def full_url(scheme="http",
 > a=None,
 > c=None,
 > f=None,
 > r=None,
 > args=[],
 > vars={},
 > anchor='',
 > path = None
 > ):
 > """
 > Create a fully qualified URL.  The URL will use the same host as the
 > request was made from, but will use the specified scheme.  Calls
 > C{gluon.html.URL()} to construct the relative path to the host.
 > 
 > if _port is set in the settings table, append the port to the
 > domain of the created URL
 > 
 > @param scheme: scheme to use for the fully-qualified URL.
 >(default to 'http')
 > @param a: application (default to current if r is given)
 > @param c: controller (default to current if r is given)
 > @param f: function (default to current if r is given)
 > @param r: request
 > @param args: any arguments (optional)
 > @param vars: any variables (optional)
 > @param anchor: anchorname, without # (optional)
 > @param path: the relative path to use.  if used overrides 
 > a,c,f,args, and
 >   vars (optional)
 > """
 > port = ''
 > if sitesettings.has_key(scheme+"_port") and 
 > sitesettings[scheme+"_port"]:
 > port = ":" + sitesettings[scheme+"_port"]
 > if scheme == 'https' and sitesettings.has_key("https_scheme"):
 > scheme = sitesettings.https_scheme
 > url = scheme +'://' + \
 > r.env.http_host.split(':')[0] + port
 > if path:
 > url = url + path
 > else:
 > url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, 
 > anchor=anchor)
 > return url
 >
 
 
 
 
>>> 
>>> 
>> 
>> 
> 




Re: [web2py] Re: URL secure flag.

2011-02-09 Thread David J.

Is the code available in the repo yet?



On 2/9/11 6:37 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 3:34 PM, David J. wrote:
So then we would use scheme='https' for secure and forget the secure 
flag?


Right. It's a little more general, since 'secure' could also imply 'wss'.





On 2/9/11 6:26 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:24 PM, Anthony wrote:
Do we want to handle websocket URLs as well (i.e., ws and wss 
schemes instead of http and https)?


I don't know. Is there an RFC yet?

I've sent Massimo a patch already, but I could redo it to directly 
specify scheme= instead of secure=, and allow an arbitrary string.


Now would be the time...


OK, I made the change. scheme='wss' (for example) works.

scheme=True uses the scheme from request.env





On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell 
wrote:


On Feb 9, 2011, at 1:24 PM, howesc wrote:
> good, bad, or indifferent, because of varied testing and
deployment setups, and using multiple ports, i have the
function below in my app.  note that i have database
configuration for HTTPS scheme and port.  It's my hack not not
run internal test and development servers on port 443. :)

Thanks. I'd forgotten about port; I'll add that as well.

>
> def full_url(scheme="http",
> a=None,
> c=None,
> f=None,
> r=None,
> args=[],
> vars={},
> anchor='',
> path = None
> ):
> """
> Create a fully qualified URL.  The URL will use the same
host as the
> request was made from, but will use the specified
scheme.  Calls
> C{gluon.html.URL()} to construct the relative path to
the host.
>
> if _port is set in the settings table, append
the port to the
> domain of the created URL
>
> @param scheme: scheme to use for the fully-qualified URL.
>(default to 'http')
> @param a: application (default to current if r is given)
> @param c: controller (default to current if r is given)
> @param f: function (default to current if r is given)
> @param r: request
> @param args: any arguments (optional)
> @param vars: any variables (optional)
> @param anchor: anchorname, without # (optional)
> @param path: the relative path to use.  if used
overrides a,c,f,args, and
>   vars (optional)
> """
> port = ''
> if sitesettings.has_key(scheme+"_port") and
sitesettings[scheme+"_port"]:
> port = ":" + sitesettings[scheme+"_port"]
> if scheme == 'https' and
sitesettings.has_key("https_scheme"):
> scheme = sitesettings.https_scheme
> url = scheme +'://' + \
> r.env.http_host.split(':')[0] + port
> if path:
> url = url + path
> else:
> url = url+URL(a=a, c=c, f=f, r=r, args=args,
vars=vars, anchor=anchor)
> return url
>



















[web2py] Re: plugin_wiki suggestions

2011-02-09 Thread Plumo
yes of course. Unfortunately that throws an error that heading is 
undefined. 

What is defined in meta-code or other models is not available.


Re: [web2py] Re: URL secure flag.

2011-02-09 Thread Jonathan Lundell
On Feb 9, 2011, at 3:43 PM, David J. wrote:
> Is the code available in the repo yet?

Not yet.

> 
> 
> 
> On 2/9/11 6:37 PM, Jonathan Lundell wrote:
>> 
>> On Feb 9, 2011, at 3:34 PM, David J. wrote:
>>> So then we would use scheme='https' for secure and forget the secure flag?
>> 
>> Right. It's a little more general, since 'secure' could also imply 'wss'.
>> 
>>> 
>>> 
>>> 
>>> On 2/9/11 6:26 PM, Jonathan Lundell wrote:
 
 On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:
> On Feb 9, 2011, at 2:24 PM, Anthony wrote:
>> Do we want to handle websocket URLs as well (i.e., ws and wss schemes 
>> instead of http and https)?
> 
> I don't know. Is there an RFC yet?
> 
> I've sent Massimo a patch already, but I could redo it to directly 
> specify scheme= instead of secure=, and allow an arbitrary string.
> 
> Now would be the time...
 
 OK, I made the change. scheme='wss' (for example) works. 
 
 scheme=True uses the scheme from request.env
 
> 
>> 
>> On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:
>> On Feb 9, 2011, at 1:24 PM, howesc wrote:
>> > good, bad, or indifferent, because of varied testing and deployment 
>> > setups, and using multiple ports, i have the function below in my app. 
>> >  note that i have database configuration for HTTPS scheme and port.  
>> > It's my hack not not run internal test and development servers on port 
>> > 443. :)
>> Thanks. I'd forgotten about port; I'll add that as well.
>> 
>> > 
>> > def full_url(scheme="http",
>> > a=None,
>> > c=None,
>> > f=None,
>> > r=None,
>> > args=[],
>> > vars={},
>> > anchor='',
>> > path = None
>> > ):
>> > """
>> > Create a fully qualified URL.  The URL will use the same host as 
>> > the
>> > request was made from, but will use the specified scheme.  Calls
>> > C{gluon.html.URL()} to construct the relative path to the host.
>> > 
>> > if _port is set in the settings table, append the port to 
>> > the
>> > domain of the created URL
>> > 
>> > @param scheme: scheme to use for the fully-qualified URL.
>> >(default to 'http')
>> > @param a: application (default to current if r is given)
>> > @param c: controller (default to current if r is given)
>> > @param f: function (default to current if r is given)
>> > @param r: request
>> > @param args: any arguments (optional)
>> > @param vars: any variables (optional)
>> > @param anchor: anchorname, without # (optional)
>> > @param path: the relative path to use.  if used overrides 
>> > a,c,f,args, and
>> >   vars (optional)
>> > """
>> > port = ''
>> > if sitesettings.has_key(scheme+"_port") and 
>> > sitesettings[scheme+"_port"]:
>> > port = ":" + sitesettings[scheme+"_port"]
>> > if scheme == 'https' and sitesettings.has_key("https_scheme"):
>> > scheme = sitesettings.https_scheme
>> > url = scheme +'://' + \
>> > r.env.http_host.split(':')[0] + port
>> > if path:
>> > url = url + path
>> > else:
>> > url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, 
>> > anchor=anchor)
>> > return url
>> >
>> 
>> 
>> 
>> 
> 
> 
 
 
>>> 
>> 
>> 
> 




[web2py] Web2py and Sencha (Extjs)

2011-02-09 Thread mikech
Has anyone looked at the recent Extjs developements or Sencha Touch?  I'm 
nowhere ready to do this, but would it be fairly simple to make use of this
library.  It seems to have a very complete set of business type widgets.   
Is anyone using it?

Mike


[web2py] Re: Book needs to be updated

2011-02-09 Thread stargate
Let me know if I can be of any help

On Feb 9, 5:18 pm, cjrh  wrote:
> On Feb 9, 9:01 pm, Richard Vézina  wrote:
>
> > We can put a frame around the screenshot... But it will make harder to have
> > unity between screenshot if it not the same person that make all of them...
>
> Good idea for frame.  Multiple people can make screenshots (e.g. let's
> say Massimo assigns a captain to each chapter, and they manage the
> work) but I still say that we must make a special theme/layout to be
> used for book screenshots, and the layout/theme must be shared with
> all the captains, so that the theming of all the screenshots is
> correct.
>
> > Or we can make a script in gimp for cropping.
>
> Sure, that kind of thing is no problem, I would actually prefer to use
> PIL over Gimp.


[web2py] dal feature request

2011-02-09 Thread elffikk
hi Massimo,

I would like to have something like sqlsoup,
but I don't need it to inspect database to do class mapping or so
I am just interested to use dal syntax without defining my tables
( they are already in the database)

When I have to develop database parts I have 2 scenarios:
- everything is built from scratch
- database already exists and I should build some functionality
without altering database

for first scenario the current dal is great, web2py handles for me
database creation, migration, etc

for second part I am forced to define tables (or to use a tool that
generates dal equivalent  structure)
but I think I don't need that, I would like an option that will let
dal expression to behave like simple sql,
without checking if table is defined or if sql fields are part of this
table, and to let my self to be sure that table and fields names are
correct

I think it should look like that

db = DAL('conn string', define_tables=False)
db(db.table1).select()
db.table1.insert(field1=1, field2='aa')

I think that is possible because DAL expressions are translated to sql
then executed,
and this implementation will need just to skip some checking in the
code

PS: I'm ok if sqlforms will not work in this mode






[web2py] Project: Web2py @ webfactional.com

2011-02-09 Thread Ahmed Bani

Hello my new community,

I have followed your suggestion and created an account at webfactional.com 
to host my web2py project at Webactional.

They have set up my account and installed web2py for me quickly!

Questions: 

1- Can you give me some instructions to get ( Web2py) Admin Area to work on 
webfactional.com ? 

   a. It keeps asking me for a password. Is it because that I have changed 
their password that I have just received for my new account, or do I have to 
follow certain instructions to log in my Administrator Area for web2py at 
Webfactional. 

2- Can you give me some new resources to read and learn how to get my web2py 
projects done at webfactional.com ?

# Some of the references that I have found by searching on google ( all over 
the Internet) are old , so I am looking forward to get some of your tips and 
advises. 

# Note ( I could not get it my web2py to work on domain.com , but I will 
keep trying some methods later and update my last topic on this group). 

Best regards,





Re: [web2py] Test if client has javascript

2011-02-09 Thread Panupat Chongstitwattana
Fist thing that comes to mind is the http-user-agent. I'm not sure if
javascript is stored in there but try print this via your browser

os.environ.get("HTTP_USER_AGENT")

see if that gives you anything.


On Thu, Feb 10, 2011 at 3:31 AM, ma...@rockiger.com
 wrote:
> The noScript-Tag works, but this way the database-query is executed. I would
> like
> to find about javascript in the request of the client.


  1   2   >