[web2py] Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread wdtatenh
attempting to login to web2py admin using IE - login fails.  - works fine 
on Mozilla Firefox

http://127.0.0.1:8000/admin/default/index?send=/default/design/welcome

Security settings for intranet are set low in IE...

I also can't login as a user (parts of my website require user login) on my 
deployed site using I.E.  I'm wondering if there is a setting in I.E.??? 
Again Firefox works fine.

Would appreciate any insights and I apologize in advance if this is a 
stupid question unrelated to web2py but the fact that everything works fine 
in Firefox but not I.E. v.9 is infuriating?

Thanks much in advance.
Bill 


[web2py] Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread David Marko
I have the same issue recently with Chrome. You just have to change URL from 
127.0.0.1 to localhost ...


[web2py] Re: Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread wdtatenh
Thanks - tried it didn't work... even removed the tail and started with 
http://.localhost:8000





[web2py] using db, auth and request objects in modules

2012-07-08 Thread Cornelius Kölbel
Hi,
I think I am missing some of the major concepts of web2py.

By some_magic^TM is got some object like "db", "request" and "auth"
available in all my controllers.
I think these are setup in db.py.
Anyway, still strange for me.

What would I need to do, when I want to make these available in some
lib/modules?
At the moment I always pass db and request as parameters.
But as these modules are only used with my web2py project, I want to get
rid of passing these parameters.

Thanks a lot and kind regards
Cornelius



signature.asc
Description: OpenPGP digital signature


Re: [web2py] publiching both apache and web2py sites

2012-07-08 Thread Manuel Gil
Hola Fernando. Me encuentro en una posición muy similar a la tuya, Servidor 
dedicado Plesk con 35 dominios. Quiero comenzar con web2py, pues me parece 
muy interesante, pero me da miedo tocar el el servidor.
Por error  di de alta un VPS con Plesk y quiero empezar a hacer pruebas 
pero voy muy mal de tiempo con algunos proyectos. Crees que podemos 
colaborar ? Ya lo has resuelto? Si no es así, te ofrezco acceso al VPS para 
probar todo lo que quieras hasta el 20 de agosto (mas o menos)  a ver si 
logramos aprender lo necesario para poner un web2py en producción .
Dime Algo.
Saludos


El sábado, 16 de junio de 2012 19:35:38 UTC+2, Fernando J escribió:
>
> Gracias 
>
> El caso es que tengo un servidor dedicado, además gestionado con Plesk, 
> donde hay unos 30 dominios reales alojados
> Y así las cosas, visto que trabajar con web2py es una decisión 
> inteligente, no debo alterar el servidor apache pero quiero
> alojar algún dominio programado bajo web2py.
> Lo ideal es que apache pudiera implementar  directivas que gesionaran 
> hacia uno u otro aldo las solicitudes en función 
> de la ubicación del dominio
>
> Saludos, Fernando J
>
> El sábado, 16 de junio de 2012 18:40:57 UTC+2, Marin Pranjić escribió:
>>
>> You need two VirtualHost configs
>>
>> http://httpd.apache.org/docs/2.0/vhosts/examples.html 
>>
>>
>> You can find examples in web2py book:
>>
>> http://web2py.com/books/default/chapter/29/13
>>
>> Marin
>>
>>

[web2py] Re: using db, auth and request objects in modules

2012-07-08 Thread Anthony
Models, controllers, and views are executed in an environment that includes 
all the web2py API objects, 
including request, response, session, etc. The objects added to the 
environment by the models are also available in the controllers and views 
(which are executed after the models) -- so if you define db and auth in 
the models, they will be available in the controllers and views. The 
objects created in the controller are not generally available in the views, 
but the items returned in a dict by a controller action are available in 
the views. See http://web2py.com/books/default/chapter/29/4#Workflow.

If you want these objects available in modules, you can use the currentobject, 
or pass them as arguments, as you have been doing. For more about 
using current, see 
http://web2py.com/books/default/chapter/29/4#Accessing-the-API-from-Python-modules
.

Anthony

On Sunday, July 8, 2012 8:48:54 AM UTC-4, cornelinux wrote:
>
>  Hi,
> I think I am missing some of the major concepts of web2py.
>
> By some_magicTM is got some object like "db", "request" and "auth" 
> available in all my controllers.
> I think these are setup in db.py.
> Anyway, still strange for me.
>
> What would I need to do, when I want to make these available in some 
> lib/modules?
> At the moment I always pass db and request as parameters.
> But as these modules are only used with my web2py project, I want to get 
> rid of passing these parameters.
>
> Thanks a lot and kind regards
> Cornelius
>
>  

[web2py] Re: translation does not translate

2012-07-08 Thread Massimo Di Pierro
Could you please check using trunk which has a smarter language detection?
This will eliminate some possibilities.

On Saturday, 7 July 2012 19:45:03 UTC-5, cornelinux wrote:
>
> Hi there, 
>
> I am using web2py 1.99.7. 
> It seems that my translation does not seem to work. 
> I updated the translations, saw my added text, translated it to german, 
> checked the browser for preferred language but still see the enflish 
> words. 
>
> How could I start here to solve my issue? 
>
> Thanks a lot and kind regards 
> Cornelius 
>
>
>

[web2py] Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread Ron McOuat
If cookies are disabled in the browser login will fail.

Ron


[web2py] Re: Web2py using json

2012-07-08 Thread Massimo Di Pierro
def index():
from simplejson import loads, dumps
data =  loads(request.vars.myvar)
return dumps(data)


On Saturday, 7 July 2012 00:47:32 UTC-5, Akash Kakkar wrote:
>
> Hi,
>
> I want to send string content (html) from client to server using JSON and 
> then decode the JSON to string in python controller, Can somebody help me 
> with the syntax.
>
> Thanks
> Akash
>


[web2py] Re: Working with custom form

2012-07-08 Thread Chris


> No, because the layout already includes a  section. The content of 
> the view gets inserted in the layout.html file at the point of the 
> {{include}}, which presumably is not in the head.


The layout also include a  section, does this mean that in my custom 
view I shouldn't have another  section such that I should just write 
all the custom html content without  tags?

Instead, you have a couple options. First, you could add the files to 
> response.files before extending the layout: 

{{response.files.extend([URL('static', 'css/css_1.css'), URL('static', 
> 'css/css_2.css')])}}
> {{extend 'layout.html'}}
>
> Then, if your layout includes web2py_ajax.html, it will link those css 
> files in the head. Alternatively, you could create a block in the head of 
> layout.html, and then customize the content of that block in your page view 
> -- see http://web2py.com/books/default/chapter/29/5#Blocks-in-views.


Another thought, can I add page-specific files for the view in the 
corresponding controller action, e.g.

def myaction():
   response.files.append(URL('static','css/page_specific_css_1.css'))
   response.files.append(URL('static','css/page_specific_css_2.css'))
   
   # rest of the action
   ...

Would this be enough? If so, how does this compare with the two options 
you've proposed below?

Regarding my other question about Recaptcha support, how should I embed and 
customize it in my custom view? Thanks very much!
 

On Saturday, July 7, 2012 11:48:05 PM UTC-4, Anthony wrote:
>
> 1. I want to utilize 'layout.html' to some extent such that it stores some 
>> common css files for the rest of the view pages. Kinda like a shared base 
>> template, and I want to add page-specific css (or js) files on individual 
>> html view page. Is it as simple as including:
>>
>> {{extend layout.html}}
>> 
>>
>>
>> 
>>
>> in the  section of a html view page? By doing this, do we append 
>> the above two css files to the list of the files in response.files (which 
>> is already set in 'layout.html')
>>
>
> No, because the layout already includes a  section. The content of 
> the view gets inserted in the layout.html file at the point of the 
> {{include}}, which presumably is not in the head. Instead, you have a 
> couple options. First, you could add the files to response.files before 
> extending the layout:
>
> {{response.files.extend([URL('static', 'css/css_1.css'), URL('static', 
> 'css/css_2.css')])}}
> {{extend 'layout.html'}}
>
> Then, if your layout includes web2py_ajax.html, it will link those css 
> files in the head. Alternatively, you could create a block in the head of 
> layout.html, and then customize the content of that block in your page view 
> -- see http://web2py.com/books/default/chapter/29/5#Blocks-in-views.
>
> Anthony 
>


Re: [web2py] web2py deployment: Watchup

2012-07-08 Thread Chibuzo Ottih
very cool

On Sun, Jul 8, 2012 at 1:16 AM, Jonathan Lundell  wrote:

> On 7 Jul 2012, at 5:15 PM, Jonathan Lundell wrote:
> >
> > I've written an iPad (only, US-only for now) app, newly in the App
> Store, that is powered on the back end by web2py.
> >
> > The marketing website (SquareSpace, not web2py): http://watchup.com
> >
> > Watchup is designed to make it easy and efficient to create a playlist
> of news videos and watch them. The backend server provides feeds (metadata,
> not the video streams), user registration, etc, to the app, and also
> implements an internal curation interface.
> >
> > The one public page on the web2py site is used to host videos when app
> users tweet them.
> >
> > The implementation is straightforward. Red Hat Enterprise Linux, Apache,
> MySQL and, of course, web2py. Plus memcached. The host is a Rackspace cloud
> server; I plan to scale by migrating the database to a dedicated server and
> replicating application servers as necessary, eventually moving curation to
> its own server as well.
> >
> > Give it a try; the app is free. http://watchup.com has a link to the
> app store.
>
> Oh, and tell your friends! Thanks!


[web2py] Re: Working with custom form

2012-07-08 Thread Anthony


The layout also include a  section, does this mean that in my custom 
> view I shouldn't have another  section such that I should just write 
> all the custom html content without  tags?
>

Right, you don't need a body tag in the view either. In layout.html, there 
should be an {{include}} -- that gets replaced with the entire contents of 
the view that extends the layout. See the /views/default/index.html view of 
the "welcome" app for an example.
 

> Another thought, can I add page-specific files for the view in the 
> corresponding controller action, e.g.
>
> def myaction():
>response.files.append(URL('static','css/page_specific_css_1.css'))
>response.files.append(URL('static','css/page_specific_css_2.css'))
>
># rest of the action
>...
>
> Would this be enough? If so, how does this compare with the two options 
> you've proposed below?
>

Yes, that's fine too. Just a matter of preference. Since the CSS relates to 
the presentation, some would argue references to it belongs in the views.
 

> Regarding my other question about Recaptcha support, how should I embed 
> and customize it in my custom view? Thanks very much!
>

I don't use reCAPTCHA, so don't have any special insights. Have you read 
the book 
section? 
Looks like it shouldn't be too difficult to add to a form.

Anthony


Re: [web2py] Re: using db, auth and request objects in modules

2012-07-08 Thread Cornelius Kölbel
Hello Anthony,

ok, now I got it.
I also added some more objects to the current object in db.py and thus
got rid of some parameters.

Thanks and kind regards
Cornelius

Am 08.07.2012 15:15, schrieb Anthony:
> Models, controllers, and views are executed in an environment that
> includes all the web2py API objects
> , including request,
> response, session, etc. The objects added to the environment by the
> models are also available in the controllers and views (which are
> executed after the models) -- so if you define db and auth in the
> models, they will be available in the controllers and views. The
> objects created in the controller are not generally available in the
> views, but the items returned in a dict by a controller action are
> available in the views.
> See http://web2py.com/books/default/chapter/29/4#Workflow.
>
> If you want these objects available in modules, you can use the
> current object, or pass them as arguments, as you have been doing. For
> more about using current,
> see 
> http://web2py.com/books/default/chapter/29/4#Accessing-the-API-from-Python-modules.
>
> Anthony
>
> On Sunday, July 8, 2012 8:48:54 AM UTC-4, cornelinux wrote:
>
> Hi,
> I think I am missing some of the major concepts of web2py.
>
> By some_magic^TM is got some object like "db", "request" and
> "auth" available in all my controllers.
> I think these are setup in db.py.
> Anyway, still strange for me.
>
> What would I need to do, when I want to make these available in
> some lib/modules?
> At the moment I always pass db and request as parameters.
> But as these modules are only used with my web2py project, I want
> to get rid of passing these parameters.
>
> Thanks a lot and kind regards
> Cornelius
>



signature.asc
Description: OpenPGP digital signature


Re: [web2py] web2py deployment: Watchup

2012-07-08 Thread Luther Goh Lu Feng
Please have it released in the Singapore Appstore!

On Sunday, July 8, 2012 10:06:36 PM UTC+8, netcode wrote:
>
> very cool
>
> On Sun, Jul 8, 2012 at 1:16 AM, Jonathan Lundell wrote:
>
>> On 7 Jul 2012, at 5:15 PM, Jonathan Lundell wrote:
>> >
>> > I've written an iPad (only, US-only for now) app, newly in the App 
>> Store, that is powered on the back end by web2py.
>> >
>> > The marketing website (SquareSpace, not web2py): http://watchup.com
>> >
>> > Watchup is designed to make it easy and efficient to create a playlist 
>> of news videos and watch them. The backend server provides feeds (metadata, 
>> not the video streams), user registration, etc, to the app, and also 
>> implements an internal curation interface.
>> >
>> > The one public page on the web2py site is used to host videos when app 
>> users tweet them.
>> >
>> > The implementation is straightforward. Red Hat Enterprise Linux, 
>> Apache, MySQL and, of course, web2py. Plus memcached. The host is a 
>> Rackspace cloud server; I plan to scale by migrating the database to a 
>> dedicated server and replicating application servers as necessary, 
>> eventually moving curation to its own server as well.
>> >
>> > Give it a try; the app is free. http://watchup.com has a link to the 
>> app store.
>>
>> Oh, and tell your friends! Thanks!
>
>
>

Re: [web2py] Re: translation does not translate

2012-07-08 Thread Cornelius Kölbel
Hello Massimo,

thanks for the hint.
The trunk works right away.
Do you need me to run some test to be able to give you more detailed
feedback?

Kind regards
Cornelius

Am 08.07.2012 15:20, schrieb Massimo Di Pierro:
> Could you please check using trunk which has a smarter language
> detection?
> This will eliminate some possibilities.
>
> On Saturday, 7 July 2012 19:45:03 UTC-5, cornelinux wrote:
>
> Hi there,
>
> I am using web2py 1.99.7.
> It seems that my translation does not seem to work.
> I updated the translations, saw my added text, translated it to
> german,
> checked the browser for preferred language but still see the
> enflish words.
>
> How could I start here to solve my issue?
>
> Thanks a lot and kind regards
> Cornelius
>
>




signature.asc
Description: OpenPGP digital signature


[web2py] Re: Keeping track of CKEditor uploads in Web2py

2012-07-08 Thread Niphlod
Using session is the simplest way to go before "opening" the editform 
of the post you'd have to (clear and) save in session some identifier of 
the post that is going to be edited and use that to "tag" every row of the 
uploads.

On Saturday, July 7, 2012 11:17:19 PM UTC+2, Athelionas wrote:
>
> Let's suppose we have a page for creating blog posts with a form with text 
> area transformed into an editor. That editor has properly configured custom 
> upload mechanism meaning that it uses a controller function such as 
> upload_file() and it also has a view which is only needed to run some 
> javascript needed by CKEditor. Then let's also suppose we have a database 
> table containing blog posts, another table containing information about 
> uploaded files, and yet another table used for defining a many-to-many 
> relation between posts and files. So every post can have files and every 
> file might belong to several posts.
>
> Now comes the tricky part. When we upload an arbitrary number of images, 
> edit the post, and press submit button we'd want to indicate in the DB that 
> the uploaded file belongs to the blog post which has just been created. 
> This is useful to prevent accidental deletion of files still used by some 
> of the blogs.
>
> Handling the blog post form and the upload separately so both the post and 
> the files get into the right table is piece of cake. But how do we handle 
> the intermediate table? How should we insert data about their relationship 
> into the table? Problem arises from the fact that uploading the image and 
> editing the post happen in different controllers and different views, so in 
> this case we cannot just use forms and the DAL to make things work, or at 
> least it's not a trivial task. 
>
> Yep, you guessed right, the question is how should we do this?
>


Re: [web2py] Re: translation does not translate

2012-07-08 Thread Massimo Di Pierro
I think I know what the problem was. languages may be country specific. The 
olf language detection needs to get the country code right. The new one 
knows better and pick the correct default language even if there is not one 
for the specific country code.

On Sunday, 8 July 2012 10:28:02 UTC-5, cornelinux wrote:
>
>  Hello Massimo,
>
> thanks for the hint.
> The trunk works right away.
> Do you need me to run some test to be able to give you more detailed 
> feedback?
>
> Kind regards
> Cornelius
>
> Am 08.07.2012 15:20, schrieb Massimo Di Pierro:
>  
> Could you please check using trunk which has a smarter language detection? 
> This will eliminate some possibilities.
>
> On Saturday, 7 July 2012 19:45:03 UTC-5, cornelinux wrote: 
>>
>> Hi there, 
>>
>> I am using web2py 1.99.7. 
>> It seems that my translation does not seem to work. 
>> I updated the translations, saw my added text, translated it to german, 
>> checked the browser for preferred language but still see the enflish 
>> words. 
>>
>> How could I start here to solve my issue? 
>>
>> Thanks a lot and kind regards 
>> Cornelius 
>>
>>
>>   
>
>  

[web2py] Re: feed agregator (planet)

2012-07-08 Thread Bruno Rocha
FOund it!

http://www.web2pyslices.com/slice/show/1407/planet-web2py

Thanks


Re: [web2py] Re: using db, auth and request objects in modules

2012-07-08 Thread Anthony
Note, if you're going to add your own objects to current, you might want to 
do so in a special namespace, such as current.app. That way, if web2py 
later adds some of its own additional objects to current, you don't have to 
worry about the names conflicting with your custom objects.

Anthony

On Sunday, July 8, 2012 11:24:18 AM UTC-4, cornelinux wrote:
>
>  Hello Anthony,
>
> ok, now I got it.
> I also added some more objects to the current object in db.py and thus got 
> rid of some parameters.
>
> Thanks and kind regards
> Cornelius
>
> Am 08.07.2012 15:15, schrieb Anthony:
>  
> Models, controllers, and views are executed in an environment that 
> includes all the web2py API 
> objects, 
> including request, response, session, etc. The objects added to the 
> environment by the models are also available in the controllers and views 
> (which are executed after the models) -- so if you define db and auth in 
> the models, they will be available in the controllers and views. The 
> objects created in the controller are not generally available in the views, 
> but the items returned in a dict by a controller action are available in 
> the views. See http://web2py.com/books/default/chapter/29/4#Workflow. 
>
>  If you want these objects available in modules, you can use the 
> currentobject, or pass them as arguments, as you have been doing. For more 
> about 
> using current, see 
> http://web2py.com/books/default/chapter/29/4#Accessing-the-API-from-Python-modules
> .
>
>  Anthony
>
> On Sunday, July 8, 2012 8:48:54 AM UTC-4, cornelinux wrote: 
>>
>>  Hi,
>> I think I am missing some of the major concepts of web2py.
>>
>> By some_magicTM is got some object like "db", "request" and "auth" 
>> available in all my controllers.
>> I think these are setup in db.py.
>> Anyway, still strange for me.
>>
>> What would I need to do, when I want to make these available in some 
>> lib/modules?
>> At the moment I always pass db and request as parameters.
>> But as these modules are only used with my web2py project, I want to get 
>> rid of passing these parameters.
>>
>> Thanks a lot and kind regards
>> Cornelius
>>
>>   
>  

[web2py] Re: Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread wdtatenh
Yes it does ask for my admin password but it just reloads the page with the 
same login screen.  

My browser has been set to accept any cookies and it still gives me the 
same response.

>
>

[web2py] Re: Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread wdtatenh
OK - now it's working - thanks for the tips.

On Sunday, July 8, 2012 9:21:45 AM UTC-4, Massimo Di Pierro wrote:
>
> Does it ask you for the admin password?
>
> On Sunday, 8 July 2012 07:44:46 UTC-5, wdtatenh wrote:
>>
>> Thanks - tried it didn't work... even removed the tail and started with 
>> http://.localhost:8000
>>
>>
>>
>>

[web2py] Re: Working with custom form

2012-07-08 Thread Chris


> Right, you don't need a body tag in the view either. In layout.html, there 
> should be an {{include}} -- that gets replaced with the entire contents 
> of the view that extends the layout.


Cool. But is there way to configure the  tag of a specific view page 
that extends the 'layout.html'? For example, for my custom view, I want its 
body tag to be like:



Is it possible to configure such thing? Thanks!


Re: [web2py] Web2py using json

2012-07-08 Thread vinicius...@gmail.com

Let's break the scenario in 2 parts.

1) How will you send it to web2py?

a) As a query string via HTTP GET encapsulated in only one param
b) As several params, using a standard query string
c) Via HTTP POST
d) Other (tell us):


2) The web2py part is easy because it's Python, anyway. Just use json 
Python module: http://docs.python.org/library/json.html


--
Vinicius Assef


On 07/07/2012 02:47 AM, Akash Kakkar wrote:

Hi,

I want to send string content (html) from client to server using JSON
and then decode the JSON to string in python controller, Can somebody
help me with the syntax.

Thanks
Akash




Re: [web2py] Re: Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread vinicius...@gmail.com

What was the solution?

On 07/08/2012 01:38 PM, wdtatenh wrote:

OK - now it's working - thanks for the tips.

On Sunday, July 8, 2012 9:21:45 AM UTC-4, Massimo Di Pierro wrote:

Does it ask you for the admin password?

On Sunday, 8 July 2012 07:44:46 UTC-5, wdtatenh wrote:

Thanks - tried it didn't work... even removed the tail and
started with http://.localhost:8000







[web2py] Looking for multi-select widget that uses two text boxes

2012-07-08 Thread MichaelF
I'm aware of the multiple and checkbox widgets. I'm looking for a widget 
whose name I don't know. It consists of two side-by-side boxes, each box 
can contain a list of items, and usually starts off with all the items in 
the left-hand box. Between the two boxes are two arrows, usually one on top 
of the other, one pointing to the right, one to the left. The left-hand box 
contains those items not 'chosen'; the right-hand box contains those 
chosen. To 'choose' items (that is, to move an item from the left-hand box 
to the right-hand box) one selects the item(s) (ctrl-click, shift-click, 
etc.) in the left-hand box, then presses the right-pointing arrow. The 
selected items move from the left-hand box to the right-hand box. To 
'un-choose' items one selects items in the right-hand box, then presses the 
left-pointing arrow.

1. What is this widget usually called?

2. Does web2py have such a widget?


[web2py] Re: Working with custom form

2012-07-08 Thread Anthony

>
> Cool. But is there way to configure the  tag of a specific view page 
> that extends the 'layout.html'? For example, for my custom view, I want its 
> body tag to be like:
>
> 
>
> Is it possible to configure such thing? Thanks!
>



and in the view:

{{body_class = 'my_css_class'}}
{{extend 'layout.html'}} 

You could also do it with a block.

Anthony


[web2py] Re: Looking for multi-select widget that uses two text boxes

2012-07-08 Thread Anthony
Not sure what that widget is usually called, but web2py does not come with 
one. Note, that kind of widget would be handled client-side via Javascript 
(e.g., http://quasipartikel.at/multiselect_next/). Once you find a 
Javascript widget you like, it shouldn't be too difficult to get it to work 
with web2py.

Anthony

On Sunday, July 8, 2012 2:10:54 PM UTC-4, MichaelF wrote:
>
> I'm aware of the multiple and checkbox widgets. I'm looking for a widget 
> whose name I don't know. It consists of two side-by-side boxes, each box 
> can contain a list of items, and usually starts off with all the items in 
> the left-hand box. Between the two boxes are two arrows, usually one on top 
> of the other, one pointing to the right, one to the left. The left-hand box 
> contains those items not 'chosen'; the right-hand box contains those 
> chosen. To 'choose' items (that is, to move an item from the left-hand box 
> to the right-hand box) one selects the item(s) (ctrl-click, shift-click, 
> etc.) in the left-hand box, then presses the right-pointing arrow. The 
> selected items move from the left-hand box to the right-hand box. To 
> 'un-choose' items one selects items in the right-hand box, then presses the 
> left-pointing arrow.
>
> 1. What is this widget usually called?
>
> 2. Does web2py have such a widget?
>


Re: [web2py] Looking for multi-select widget that uses two text boxes

2012-07-08 Thread Bruno Rocha
I guess you need this:

http://www.web2pyslices.com/slice/show/1526/cascading-drop-down-lists-with-ajax-2



*Bruno Cezar Rocha*

http://www.CursoDePython.com.br
[image: Facebook]  [image:
Twitter] [image:
LinkedIn]  [image:
about.me] [image:
Amazon]  [image:
AngelList] [image:
Blog RSS]  [image:
Facebook Page]  [image:
foursquare] [image:
Google Plus]  [image:
pinterest]  [image:
SlideShare] [image:
YouTube] 
 [image: Google Talk] rochacbruno [image: Skype] blouweb
Blog: Generate a thumbnail that fits in a
box
  Get a signature like this.

Click
here.



On Sun, Jul 8, 2012 at 3:10 PM, MichaelF  wrote:

> I'm aware of the multiple and checkbox widgets. I'm looking for a widget
> whose name I don't know. It consists of two side-by-side boxes, each box
> can contain a list of items, and usually starts off with all the items in
> the left-hand box. Between the two boxes are two arrows, usually one on top
> of the other, one pointing to the right, one to the left. The left-hand box
> contains those items not 'chosen'; the right-hand box contains those
> chosen. To 'choose' items (that is, to move an item from the left-hand box
> to the right-hand box) one selects the item(s) (ctrl-click, shift-click,
> etc.) in the left-hand box, then presses the right-pointing arrow. The
> selected items move from the left-hand box to the right-hand box. To
> 'un-choose' items one selects items in the right-hand box, then presses the
> left-pointing arrow.
>
> 1. What is this widget usually called?
>
> 2. Does web2py have such a widget?
>


[web2py] Re: Web2py hanging with no errors in the log

2012-07-08 Thread howesc
i don't know your setup, so i can't say where to look for the web2py logs, 
but i would recommend increasing the log level in logging.conf, and adding 
some extra debug or info log statements to see if something is getting 
stuck along the way in your code.

On Friday, July 6, 2012 5:52:11 PM UTC-7, Maggs wrote:
>
> That's an excellent theory and would make total sense, except I can't see 
> where there could possibly be an infinite loop as I only loop through 
> objects or db results. And I'm using mysql, not postgres. And I have 
> verified that there are no nulls where I have a notnull=True set just to be 
> sure.
> The lack of any errors is making this extremely annoying.
>
> Thank you very much for your help though :)
>
> On Friday, July 6, 2012 11:41:15 AM UTC-7, Cliff Kachinske wrote:
>>
>> An infinite loop causes this behavior.  Don't Ask Me How I Know This :).
>>
>> Also, with Postgres, I *think* this has happened because certain 
>> migrations cause existing data in a field to fail a new constraint.  This 
>> would happen if you make notnull=True on a field that already contains 
>> null.  However, if your all your models execute on every request you will 
>> see this happen right away.  It won't be intermittent.
>>
>> On Friday, June 22, 2012 4:34:35 PM UTC-4, Maggs wrote:
>>>
>>> Hi all, 
>>>
>>> I have a web2py healthcheck monitoring application. Basically the only 
>>> thing the 
>>> application does is make database queries to find healthcheck data and 
>>> make REST 
>>> api calls to a separate web2py application for information on the 
>>> environment. 
>>>
>>> Recently the application has been "crashing" at least once a day. The 
>>> web2py 
>>> process still exists, but users are unable to connect to the 
>>> application. There 
>>> are no errors in the logs or any useful information in the 
>>> httpserver.log, it's 
>>> like web2py just hangs and I have to restart it. I'm at my wits end 
>>> trying to 
>>> figure out what is happening so I figured I'd see if anyone has 
>>> experienced this 
>>> before or has any tips on log files I'm unaware of to check. 
>>>
>>> Thanks! 
>>>
>>>

[web2py] Re: paymentech: post request

2012-07-08 Thread howesc
i've never used HTTP lib before, and i found "This module defines classes 
which implement the client side of the HTTP and HTTPS protocols. It is 
normally not used directly — the module 
urllibuses it to 
handle URLs that use HTTP and HTTPS." here 
http://docs.python.org/library/httplib.html

perhaps give urllib or urllib2 a try - i use those all the time with great 
success!

cfh

On Friday, July 6, 2012 10:30:34 AM UTC-7, Adi wrote:
>
>
> Could anyone please advise if I'm doing this correctly? I'm trying to post 
> a request to Paymentech gateway. When I try the link in a browser, it 
> responds fine (https://orbitalvar1.paymentech.net/authorize:443), but 
> using post as bellow returns an error. Most likely I'm doing something 
> wrong, but can't figure out what.
>
> Thanks,
> Adnan
>
>
> *CODE:*
> import sys, httplib
>
> request = xml_string # "proper xml request..."
>
> HOST = "https://orbitalvar1.paymentech.net/authorize:443";
> # tried without https as well: HOST = "
> orbitalvar1.paymentech.net/authorize:443"
> webservice = httplib.HTTPS(HOST)
> webservice.putrequest("POST", '')
> webservice.putheader("Host", HOST)
> webservice.putheader("User-Agent","Python post")
> webservice.putheader("Content-Type", "application/PTI46")
> webservice.putheader("Content-transfer-encoding", "text")
> webservice.putheader("Content-length", "%d" % len(request))
> webservice.endheaders()
> webservice.send(request)
> statuscode, statusmessage, header = webservice.getreply()
> print statuscode, statusmessage, header
>
> *TRACEBACK:*
> Traceback (most recent call last):
>   File "/Users/adnan/web2py-dev-branch8/gluon/restricted.py", line 205, in 
> restricted
> exec ccode in environment
>   File 
> "/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
>  
> line 898, in 
>   File "/Users/adnan/web2py-dev-branch8/gluon/globals.py", line 173, in 
> 
> self._caller = lambda f: f()
>   File 
> "/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
>  
> line 43, in test_pmt
> paymentech.do_request(xml_string)
>   File "applications/dev_thanemobile/modules/paymentech.py", line 46, in 
> do_request
> webservice.endheaders()
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>  
> line 937, in endheaders
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>  
> line 797, in _send_output
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>  
> line 759, in send
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>  
> line 1140, in connect
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
>  
> line 553, in create_connection
> *gaierror: [Errno 8] nodename nor servname provided, or not known*
>
>

Re: [web2py] Looking for multi-select widget that uses two text boxes

2012-07-08 Thread MichaelF
Thanks, Bruno. That's not quite what I need for this job, but I do need 
that in another. I need something more like what Anthony posted (
http://quasipartikel.at/multiselect_next/).

On Sunday, July 8, 2012 12:42:09 PM UTC-6, rochacbruno wrote:
>
> I guess you need this:
>
>
> http://www.web2pyslices.com/slice/show/1526/cascading-drop-down-lists-with-ajax-2
>
>
>
> *Bruno Cezar Rocha*
>
> http://www.CursoDePython.com.br
> [image: Facebook]  [image: 
> Twitter] [image: 
> LinkedIn]  [image: 
> about.me] [image: 
> Amazon]  [image: 
> AngelList] [image: 
> Blog RSS]  [image: 
> Facebook Page]  [image: 
> foursquare] [image: 
> Google Plus]  
> [image: 
> pinterest]  [image: 
> SlideShare] [image: 
> YouTube] 
>  [image: Google Talk] rochacbruno [image: Skype] blouweb
> Blog: Generate a thumbnail that fits in a 
> box
>   Get a signature like this. 
> 
>  Click 
> here.
>
>
>
>
> On Sun, Jul 8, 2012 at 3:10 PM, MichaelF wrote:
>
>> I'm aware of the multiple and checkbox widgets. I'm looking for a widget 
>> whose name I don't know. It consists of two side-by-side boxes, each box 
>> can contain a list of items, and usually starts off with all the items in 
>> the left-hand box. Between the two boxes are two arrows, usually one on top 
>> of the other, one pointing to the right, one to the left. The left-hand box 
>> contains those items not 'chosen'; the right-hand box contains those 
>> chosen. To 'choose' items (that is, to move an item from the left-hand box 
>> to the right-hand box) one selects the item(s) (ctrl-click, shift-click, 
>> etc.) in the left-hand box, then presses the right-pointing arrow. The 
>> selected items move from the left-hand box to the right-hand box. To 
>> 'un-choose' items one selects items in the right-hand box, then presses the 
>> left-pointing arrow.
>>
>> 1. What is this widget usually called?
>>
>> 2. Does web2py have such a widget?
>>
>
>

[web2py] Re: using db, auth and request objects in modules

2012-07-08 Thread Cliff Kachinske
You can also create your own storage object.

import storage as st
mystore = st.Storage
mystore.request = request


t

read gluon/storage.py for more information.  Lots of neat functions there.

On Sunday, July 8, 2012 8:48:54 AM UTC-4, cornelinux wrote:
>
>  Hi,
> I think I am missing some of the major concepts of web2py.
>
> By some_magicTM is got some object like "db", "request" and "auth" 
> available in all my controllers.
> I think these are setup in db.py.
> Anyway, still strange for me.
>
> What would I need to do, when I want to make these available in some 
> lib/modules?
> At the moment I always pass db and request as parameters.
> But as these modules are only used with my web2py project, I want to get 
> rid of passing these parameters.
>
> Thanks a lot and kind regards
> Cornelius
>
>  

[web2py] Re: Production performance lessions uwsgi + nginx

2012-07-08 Thread Cliff Kachinske
Bruce,

I have learned a lot from reading the threads you start.

Thanks for taking the time.

Cliff Kachinske

On Saturday, July 7, 2012 10:36:57 AM UTC-4, Bruce Wade wrote:
>
> Thanks to help from the uwsgi group (Specifically Ryan Showalter and 
> Lukasz Mierzwa) I learned about two important settings to help speed up 
> web2py sites.
>
> I hope this advice helps anyone else who is using uwsgi and has a very 
> slow site with traffic starts poring in.
>
> 1) Set --cpu-affinity when you are starting uwsgi. I used 3 so 3 processes 
> will be handled by each processor (I set 12 workers in nginx config, 3 
> Workers * 4 CUPs)
> http://lists.unbit.it/pipermail/uwsgi/2011-March/001594.html
>
> 2) Use a socket file instead of the TCP stack with uwsgi_pass and when 
> starting uwsgi:
> in uwsgi config use: "socket = /var/run/uwsgi.socket"
> in nginx config use: "uwsgi_pass  unix:///var/run/uwsgi.socket;"
> http://lists.unbit.it/pipermail/uwsgi/2011-September/002625.html
>
> Comments directly from Lukasz:
> It's hard to saturate single core with just one worker since it might wait 
> for
> external resources like memcached, db or client, 2-4 workers per core seems
> like a good starting point, but check how many workers can fit in ram 
> before
> you start setting very high max number of workers. Once you're out of 
> memory
> and you hit swap all the performance of fast server is gone. If you use 
> cgroup
> memory limits in uWSGI than it will start swapping workers memory to disk 
> once
> they eat all memory they can.
> If you use max-requests or memory limits in uWSGI config than check how 
> long
> does it take in peak hours to hit that limit and reload worker, it might
> happen to frequently, and if your app takes to long to start it might slow
> everything down.
> Keep in mind that high number of workers may hit max database connection 
> limit
> (it depends on db you use).
> As always - if you can benchmark you workers, apache benchmark or siege are
> good enough to get some idea of how many request per second you can get.
>
> Also - if you can change the way nginx talks to uwsgi - instead of local 
> tcp
> connection use file socket - you want hammer tcp stack with a lot of
> connections.
>
> in uwsgi config use: "socket = /var/run/uwsgi.socket"
> in nginx config use: "uwsgi_pass  unix:///var/run/uwsgi.socket;"
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

[web2py] web2py DAL connection failing in Apache?

2012-07-08 Thread Osman Masood

Hi,
I'm running web2py from an Apache server (in production), and it 
occasionally shuts down, i.e. fails to connect to the DAL until Apache is 
reset with 'sudo service apache2 restart'. The version of web2py is: 
Version 2.0.0 (2012-05-16 18:23:15) dev
Running on Apache/2.2.14 (Ubuntu)


Here's the traceback:

TRACEBACK

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/main.py", line 538, in wsgibase
session._try_store_on_disk(request, response)
  File "/home/www-data/web2py/gluon/globals.py", line 649, in _try_store_on_disk
cPickle.dump(dict(self), response.session_file)
  File "/home/V_ENVS/Web2py/lib/python2.6/copy_reg.py", line 74, in _reduce_ex
getstate = self.__getstate__
  File "/home/www-data/web2py/gluon/dal.py", line 6918, in __getattr__
self.__allocate()
  File "/home/www-data/web2py/gluon/dal.py", line 6911, in __allocate
self._record = self._table[int(self)]
  File "/home/www-data/web2py/gluon/dal.py", line 7186, in __getitem__
return self._db(self._id == key).select(limitby=(0,1)).first()
  File "/home/www-data/web2py/gluon/dal.py", line 8189, in select
return adapter.select(self.query,fields,attributes)
  File "/home/www-data/web2py/gluon/dal.py", line 1410, in select
rows = response(sql)
  File "/home/www-data/web2py/gluon/dal.py", line 1400, in response
self.execute(sql)
  File "/home/www-data/web2py/gluon/dal.py", line 1489, in execute
return self.log_execute(*a, **b)
  File "/home/www-data/web2py/gluon/dal.py", line 1483, in log_execute
ret = self.cursor.execute(*a, **b)
  File "/home/www-data/web2py/gluon/contrib/pymysql/cursors.py", line 108, in 
execute
self.errorhandler(self, exc, value)
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 184, 
in defaulterrorhandler
raise errorclass, errorvalue
InterfaceError: (0, '')


Any idea about what's going on? Thanks for all the help guys! 


[web2py] Re: Working with custom form

2012-07-08 Thread Chris

Now I have the custom page (e.g. register) appears correctly, however, when 
I submit the form nothing happens - the form just clears itself with no 
error msg or anything.

My 'register' action in controller is:

def register():
return dict(form=auth.register())

My 'layout.html' is as follows:




  
  {{=response.title or request.application}}
  

  
  
  
  

  
  

  
  {{
response.files.append(URL('static','css/bootstrap.min.css'))
response.files.append(URL('static','css/bootstrap-responsive.min.css')) 
  }}

  {{include 'web2py_ajax.html'}}



  {{include}}
  {{if response.google_analytics_id:}} var 
_gaq = _gaq || []; _gaq.push(['_setAccount', 
'{{=response.google_analytics_id}}']); _gaq.push(['_trackPageview']); 
(function() { var ga = document.createElement('script'); ga.type = 
'text/javascript'; ga.async = true; ga.src = ('https:' == 
document.location.protocol ? 'https://ssl' : 'http://www') + 
'.google-analytics.com/ga.js'; var s = 
document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, 
s); })();  {{pass}}



And my 'register.html' view is:

{{body_class = 'own'}}
{{
response.files.append(URL('static', 'css/jquery.h5form-2.4.1.css'))
response.files.append(URL('static', 'css/own.css')) 
}}
{{extend 'layout.html'}}

Sign up
Create Your Account




First name*

Last name*

Email*

Password*

Re-password*




I acknowledge 
that I have read and accept the Terms and Conditions











As advised by people earlier, in the form above, I match the 'name' 
attribute of each input field with the corresponding column name of the *
auth_user *table. I wonder what is missing here?


[web2py] sending emails from a google account

2012-07-08 Thread Janath
Hi,

I have very limited emails in configuring email servers.

I try to used my gmail account to send emails from web2py. 

I used the following settings with my specific information (as mentioned in 
the web2py book):

mail = auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:465'
mail.settings.sender = 'jana...@gmail.com'
mail.settings.login = 'jana...@gmail.com:*mypassword*'
mail.settings.server = 'logging'


It says mail sent, but I couldnt see it in my account.

Is this something doable... If this can be configured in a simple way, I 
would appreciate some help.

Thank you 





[web2py] Re: sending emails from a google account

2012-07-08 Thread Niphlod
mail.settings.server = 'logging' just writes if the mail is sent on the 
console, and it's only for debugging purposes.

You should remove that line and leave only mail.settings.server='
smtp.gmail.com:465' to actually send any email.

On Monday, July 9, 2012 1:18:49 AM UTC+2, Janath wrote:
>
> Hi,
>
> I have very limited emails in configuring email servers.
>
> I try to used my gmail account to send emails from web2py. 
>
> I used the following settings with my specific information 
> (as mentioned in the web2py book):
>
> mail = auth.settings.mailer
> mail.settings.server = 'smtp.gmail.com:465'
> mail.settings.sender = 'jana...@gmail.com'
> mail.settings.login = 'jana...@gmail.com:*mypassword*'
> mail.settings.server = 'logging'
>
>
> It says mail sent, but I couldnt see it in my account.
>
> Is this something doable... If this can be configured in a simple way, I 
> would appreciate some help.
>
> Thank you 
>
>
>
>

[web2py] Re: how to avoid (catch) sqllite operational error

2012-07-08 Thread Massimo Di Pierro
try:

except: #catch all
   db.rollback()
   .

On Sunday, 8 July 2012 17:39:46 UTC-5, Janath wrote:
>
> Hi,
>
> I populate a database table by a csv file.
>
> In run time, if the user tries to upload a file having different format to 
> the table. A sqllite operational error is detected.
>
> In that case I need to inform the user that the file has invalid format.
>
> I tried with
>
> try:
> 
> 
> except RuntimeError:
> response.flash='Error'
> return dict(form=form)
>
>
> I'm unable to catch the error... I have attached the error report
>
> Plase advice as to how I can avoid a run time error and display a message 
> instead.
>
> Thank you
>
>
>

[web2py] problem with custom primarykey

2012-07-08 Thread Vincenzo Ampolo
Hi,

I'm trying to set up primary keys for the table 'ratings' described as :

db.define_table('users',
Field('name'),
Field('email'),
Field('imdb_id', 'integer')
)

db.define_table('movies',
Field('imdb_id', 'integer')
)

db.define_table('ratings',
Field('iuser', db.users, requires =
IS_IN_DB(db,'users.id',db.users._format)),
Field('imovie', db.movies, requires =
IS_IN_DB(db,'movies.id',db.movies._format)),
Field('rating', 'double'),
primarykey=['iuser', 'imovie'],
)

Reading the web2py book I saw:
http://web2py.com/books/default/chapter/29/6#Legacy-databases-and-keyed-tables

Referenceing fields must use the reference tablename.fieldname format.

But what does it mean? I tried many combinations like :
['iuser.id', 'imovie.id']
['users', 'movies']
['users.id', 'movies.id']

But none of them work. I end up with two errors: The first one states
that i should use fields defined in the ratings table and the second one
is that the given string cannot be splitted at the dot.

What am i doing wrong?
-- 
Vincenzo Ampolo
http://vincenzo-ampolo.net
http://goshawknest.wordpress.com



Re: [web2py] web2py DAL connection failing in Apache?

2012-07-08 Thread Ovidio Marinho
have you ever tried

#sudo /etc/init.d/apache2 stop
#sudo /etc/init.d/apache2 start

if this does not work, use this:

http://www.web2pyslices.com/slice/show/1356/setup-web2pyapachesslmod-wsgipostgresql-in-few-seconds




   Ovidio Marinho Falcao Neto
Web Developer
 ovidio...@gmail.com
  ovidiomari...@itjp.net.br
 ITJP - itjp.net.br
   83   8826 9088 - Oi
   83   9334 0266 - Claro
Brasil




2012/7/8 Osman Masood 

>
> Hi,
> I'm running web2py from an Apache server (in production), and it
> occasionally shuts down, i.e. fails to connect to the DAL until Apache is
> reset with 'sudo service apache2 restart'. The version of web2py is:
>  Version 2.0.0 (2012-05-16 18:23:15) dev
> Running on Apache/2.2.14 (Ubuntu)
>
>
> Here's the traceback:
>
> TRACEBACK
>
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
> 29.
>
> Traceback (most recent call last):
>
>   File "/home/www-data/web2py/gluon/main.py", line 538, in wsgibase
>
> session._try_store_on_disk(request, response)
>
>   File "/home/www-data/web2py/gluon/globals.py", line 649, in 
> _try_store_on_disk
>
> cPickle.dump(dict(self), response.session_file)
>
>   File "/home/V_ENVS/Web2py/lib/python2.6/copy_reg.py", line 74, in _reduce_ex
>
> getstate = self.__getstate__
>   File "/home/www-data/web2py/gluon/dal.py", line 6918, in __getattr__
>
> self.__allocate()
>   File "/home/www-data/web2py/gluon/dal.py", line 6911, in __allocate
>
> self._record = self._table[int(self)]
>
>   File "/home/www-data/web2py/gluon/dal.py", line 7186, in __getitem__
>
> return self._db(self._id == key).select(limitby=(0,1)).first()
>
>   File "/home/www-data/web2py/gluon/dal.py", line 8189, in select
>
> return adapter.select(self.query,fields,attributes)
>
>   File "/home/www-data/web2py/gluon/dal.py", line 1410, in select
>
> rows = response(sql)
>   File "/home/www-data/web2py/gluon/dal.py", line 1400, in response
>
> self.execute(sql)
>   File "/home/www-data/web2py/gluon/dal.py", line 1489, in execute
>
> return self.log_execute(*a, **b)
>
>   File "/home/www-data/web2py/gluon/dal.py", line 1483, in log_execute
>
> ret = self.cursor.execute(*a, **b)
>
>   File "/home/www-data/web2py/gluon/contrib/pymysql/cursors.py", line 108, in 
> execute
>
> self.errorhandler(self, exc, value)
>
>   File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 
> 184, in defaulterrorhandler
>
> raise errorclass, errorvalue
> InterfaceError: (0, '')
>
>
> Any idea about what's going on? Thanks for all the help guys!
>


[web2py] Re: Working with custom form

2012-07-08 Thread Anthony
As was mentioned earlier, if you're going to create a custom form like 
that, in place of , you need to include {{=form.custom.end}}. The 
reason is that web2py forms include two hidden fields, _formname and 
_formkey, and form.custom.end will add those hidden fields. They are used 
to protect against double form submission and CSRF attacks. See 
http://web2py.com/books/default/chapter/29/7#Hidden-fields and 
http://web2py.com/books/default/chapter/29/7#Custom-forms.

Anthony

On Sunday, July 8, 2012 7:14:51 PM UTC-4, Chris wrote:
>
>
> Now I have the custom page (e.g. register) displays correctly, however, 
> when I submit the form *nothing happens - the form just clears itself 
> with no error msg or anything*.
>
> My 'register' action in controller is:
>
> def register():
> return dict(form=auth.register())
>
> My 'layout.html' is as follows:
>
> 
> 
> 
>   
>   {{=response.title or request.application}}
>   
>
>   
>   
>   
>   
>
>   
>   
>
>   
>   {{
> response.files.append(URL('static','css/bootstrap.min.css'))
> 
> response.files.append(URL('static','css/bootstrap-responsive.min.css')) 
>   }}
>
>   {{include 'web2py_ajax.html'}}
>
> 
> 
>   {{include}}
>   {{if response.google_analytics_id:}} var 
> _gaq = _gaq || []; _gaq.push(['_setAccount', 
> '{{=response.google_analytics_id}}']); _gaq.push(['_trackPageview']); 
> (function() { var ga = document.createElement('script'); ga.type = 
> 'text/javascript'; ga.async = true; ga.src = ('https:' == 
> document.location.protocol ? 'https://ssl' : 'http://www') + '.
> google-analytics.com/ga.js'; var s = 
> document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, 
> s); })();  {{pass}}
> 
> 
>
> And my 'register.html' view is:
>
> {{body_class = 'own'}}
> {{
> response.files.append(URL('static', 'css/jquery.h5form-2.4.1.css'))
> response.files.append(URL('static', 'css/own.css')) 
> }}
> {{extend 'layout.html'}}
> 
> Sign up
> Create Your Account
> 
> 
>  class="own-form h5form">
> 
> First name*
>  placeholder="enter first name ..." required="required" tabindex="0">
> Last name*
>  placeholder="enter last name ..." required="required" tabindex="1">
> Email*
>  placeholder="enter email ..." required="required" tabindex="2">
> Password*
>  placeholder="enter password ..." required="required" tabindex="3">
> Re-password*
>  placeholder="enter password again ..." required="required" tabindex="4">
> 
> 
> 
> I acknowledge 
> that I have read and accept the Terms and Conditions
> 
>  style="margin-top: 15px;" value="Register">
> 
> 
> 
> 
> 
> 
> 
> 
>
> As told by people earlier, in the form above, I match the 'name' attribute 
> of each input field with the corresponding column name of the *auth_user 
> *table. 
> What is missing here?
>


[web2py] Re: Keeping track of CKEditor uploads in Web2py

2012-07-08 Thread Athelionas
Hmm, I'll look into it. Many thanks for the great idea.

2012. július 8., vasárnap 17:28:58 UTC+2 időpontban Niphlod a következőt 
írta:
>
> Using session is the simplest way to go before "opening" the editform 
> of the post you'd have to (clear and) save in session some identifier of 
> the post that is going to be edited and use that to "tag" every row of the 
> uploads.
>
> On Saturday, July 7, 2012 11:17:19 PM UTC+2, Athelionas wrote:
>>
>> Let's suppose we have a page for creating blog posts with a form with 
>> text area transformed into an editor. That editor has properly configured 
>> custom upload mechanism meaning that it uses a controller function such as 
>> upload_file() and it also has a view which is only needed to run some 
>> javascript needed by CKEditor. Then let's also suppose we have a database 
>> table containing blog posts, another table containing information about 
>> uploaded files, and yet another table used for defining a many-to-many 
>> relation between posts and files. So every post can have files and every 
>> file might belong to several posts.
>>
>> Now comes the tricky part. When we upload an arbitrary number of images, 
>> edit the post, and press submit button we'd want to indicate in the DB that 
>> the uploaded file belongs to the blog post which has just been created. 
>> This is useful to prevent accidental deletion of files still used by some 
>> of the blogs.
>>
>> Handling the blog post form and the upload separately so both the post 
>> and the files get into the right table is piece of cake. But how do we 
>> handle the intermediate table? How should we insert data about their 
>> relationship into the table? Problem arises from the fact that uploading 
>> the image and editing the post happen in different controllers and 
>> different views, so in this case we cannot just use forms and the DAL to 
>> make things work, or at least it's not a trivial task. 
>>
>> Yep, you guessed right, the question is how should we do this?
>>
>

[web2py] Ajax div refresh on form submission

2012-07-08 Thread Andrew Evans
Hello I have two functions one for querying the data base and one for
submitting data. I also have one view for the form and one load file for
the database query I then LOAD the load file into index view

{{extend "template.html"}}



 {{=LOAD('default', 'ajax_example.load', ajax=True)}}





My Form controller

@auth.requires_login()
def myform():
form = SQLFORM(db.music2)
if form.accepts(request.vars):
   response.flash='Thanks for filling the form'
   #"%s",[],"song_list" is a reference to a div that gets called and
updated
   return XML('ajax("%s",[],"song_list");' % URL('default',
'ajax_example.load'))
elif form.errors:
response.flash='Fill the form correctly'
else:
response.flash='Please, fill the form'

return dict(form=form)

Ok I guess my problem is how can I update song_list with out a page refresh
keep in mind the form is on a separate page then the query

How can I get return XML('ajax("%s",[],"song_list");' % URL('default',
'ajax_example.load')) to display the form again with a response.flash
message and then update the div on the separate page in real time?

Any ideas

*cheers :-)


[web2py] Re: paymentech: post request

2012-07-08 Thread Adi
Thanks for the response. 

Even though I got this response: 412 Precondition Failed, the code bellow 
seems to work fine. Will check more tomorrow. 

import sys, httplib, urllib, urllib2
target = "https://orbitalvar1.paymentech.net/authorize:443";
HOST, API_URL = urllib2.splithost(urllib2.splittype(target)[1])
xml_request="proper security and order details..."

conn = httplib.HTTPS(HOST)
conn.putrequest('POST', API_URL)
conn.putheader("Content-Type", "application/PTI46")
conn.putheader("Content-transfer-encoding", "text")
conn.putheader("Document-type", "Request")
conn.putheader("Trace-number", "123456")
conn.putheader("MIME-Version", "1.0")
conn.endheaders()
conn.send(xml_request)
statuscode, statusmessage, header = conn.getreply()




On Sunday, July 8, 2012 2:52:14 PM UTC-4, howesc wrote:
>
> i've never used HTTP lib before, and i found "This module defines classes 
> which implement the client side of the HTTP and HTTPS protocols. It is 
> normally not used directly — the module 
> urllibuses it to 
> handle URLs that use HTTP and HTTPS." here 
> http://docs.python.org/library/httplib.html
>
> perhaps give urllib or urllib2 a try - i use those all the time with great 
> success!
>
> cfh
>
> On Friday, July 6, 2012 10:30:34 AM UTC-7, Adi wrote:
>>
>>
>> Could anyone please advise if I'm doing this correctly? I'm trying to 
>> post a request to Paymentech gateway. When I try the link in a browser, it 
>> responds fine (https://orbitalvar1.paymentech.net/authorize:443), but 
>> using post as bellow returns an error. Most likely I'm doing something 
>> wrong, but can't figure out what.
>>
>> Thanks,
>> Adnan
>>
>>
>> *CODE:*
>> import sys, httplib
>>
>> request = xml_string # "proper xml request..."
>>
>> HOST = "https://orbitalvar1.paymentech.net/authorize:443";
>> # tried without https as well: HOST = "
>> orbitalvar1.paymentech.net/authorize:443"
>> webservice = httplib.HTTPS(HOST)
>> webservice.putrequest("POST", '')
>> webservice.putheader("Host", HOST)
>> webservice.putheader("User-Agent","Python post")
>> webservice.putheader("Content-Type", "application/PTI46")
>> webservice.putheader("Content-transfer-encoding", "text")
>> webservice.putheader("Content-length", "%d" % len(request))
>> webservice.endheaders()
>> webservice.send(request)
>> statuscode, statusmessage, header = webservice.getreply()
>> print statuscode, statusmessage, header
>>
>> *TRACEBACK:*
>> Traceback (most recent call last):
>>   File "/Users/adnan/web2py-dev-branch8/gluon/restricted.py", line 205, 
>> in restricted
>> exec ccode in environment
>>   File 
>> "/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
>>  
>> line 898, in 
>>   File "/Users/adnan/web2py-dev-branch8/gluon/globals.py", line 173, in 
>> 
>> self._caller = lambda f: f()
>>   File 
>> "/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
>>  
>> line 43, in test_pmt
>> paymentech.do_request(xml_string)
>>   File "applications/dev_thanemobile/modules/paymentech.py", line 46, in 
>> do_request
>> webservice.endheaders()
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 937, in endheaders
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 797, in _send_output
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 759, in send
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 1140, in connect
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
>>  
>> line 553, in create_connection
>> *gaierror: [Errno 8] nodename nor servname provided, or not known*
>>
>>

[web2py] Re: Ajax div refresh on form submission

2012-07-08 Thread Andrew Evans
Ok my approach was a bit off. I got the div to update on form submission.
But how to separate the form view from the same page as the view to display
updates?

 which I think has to do with this

return XML('ajax("%s",[],"#song_list");' % URL('default',
'ajax_example.load'))

Any ideas


[web2py] Re: Getting auth.settings.register_next to work...

2012-07-08 Thread Anthony
For those interested, in trunk, auth.navbar() now takes a referrer_actions 
argument. If you do:

auth.navbar(referrer_actions=None)

It will no longer add referrer URLs to the query strings of any of the 
navbar links, so any auth.settings._next settings will take 
precedence in that case. If you want referrer URLs for some but not all of 
the actions, you can add them to a list:

auth.navbar(referrer_actions=['login', 'profile'])

Note, by default, all links (except logout) still get referrer URLs in the 
query string, which is unchanged from the original behavior -- so if you 
want the original behavior, you don't have to do anything different (i.e., 
this is backward compatible).

Anthony

On Saturday, June 30, 2012 10:12:50 AM UTC-4, Anthony wrote:
>
> Looks like auth.navbar() automatically adds the current URL as the _next 
> parameter so whenever someone clicks on an auth.navbar() link, after 
> finishing that action, they are returned to their original page. Also, 
> auth.settings.register_next (and similar) are only used as backup defaults 
> when there is no _next parameter in the URL (i.e., _next takes precedence). 
> Perhaps we should make it easier to override these two behaviors. For now, 
> though, I think you have a few options.
>
> First, right after you define auth, do:
>
> auth = Auth(...)
> auth.next = None
>
> That should remove the _next value, which will allow the 
> auth.settings.register_next setting to take effect. Alternatively, right *
> before* you define auth, you can remove _next from request.vars:
>
> request.vars._next = None
> auth = Auth(...)
>
> You can also pass a "next" argument directly to the auth.register() 
> function (and other Auth functions):
>
> def user():
> if request.args(0) == 'register':
> form = auth.register(next=auth.settings.register_next)
> else:
> form = auth()
> return dict(form=form)
>
> Anthony
>
> On Saturday, June 30, 2012 2:37:36 AM UTC-4, Doug Philips wrote:
>>
>> I've been customizing how registration works for my app as a few of my 
>> app's users are getting confused by the registration verification 
>> email. 
>> Ok, so I will just have my app send them to a nice hand-holding 
>> explanatory page after they've submitted their registration 
>> information. 
>>
>> According to The Book, "all" I have to do is set 
>> auth.settings.register_next to the URL I want, and I'm good to go. 
>> But I can't get that to work. 
>>
>> (all line numbers are for 
>> https://github.com/web2py/web2py/blob/master/gluon/tools.py as of the 
>> time of this message) 
>>
>> First off, it seems that the Register link I get from auth.navbar() 
>> always has a _next parameter appended to it, 
>> and that _next seems to override anything I set in my model for 
>> auth.settings.registration_next. 
>> Fine, I go into the navbar function of the Auth class in tools.py and 
>> delete the "+next" part of the registration link. (line 1242) 
>> That doesn't work, as for some reason I don't understand, the ?_next 
>> parameter in the URL is still present when the navbar is constructed 
>> from a regular page, but the ?_next parameter is (properly) missing 
>> from Register link when I first click on Login. Very odd to me. 
>>
>> After trying a few more fixes, I decide that I do not understand how 
>> next processing is done for Auth. 
>> My fix is a huge hammer. 
>> I go into the register function and change lines 1983 and 1984. 
>> Actually I delete them and replace them with: 
>> next = self.settings.register_next 
>>
>> I have no idea what the lines I deleted are trying to do, but they 
>> were keeping my expressed intent from working. 
>> Now my users are directed to the page I want after submitting their 
>> registrations, but I have no idea what else I have subtly screwed up. 
>> I don't even know if I should submit a bug report or if there is some 
>> other configuration I could do that would avoid having to make this 
>> code change. 
>> Help! 
>>
>> -Doug 
>>
>

[web2py] Re: Ajax div refresh on form submission

2012-07-08 Thread Andrew Evans
Spoke to soon the div does not update.

What I am after is the div song_list refreshing in real time. I appreciate
any help offered

*cheers

*controllers*

def index():
return dict()

def page_with_form():
return dict()

def ajax_example():
rows = db(db.music2.id>0).select()
return dict(rows=rows)

def myform():
form = SQLFORM(db.music2)
if form.accepts(request.vars):
   response.flash='Thanks for filling the form'
   #"%s",[],"song_list" is a reference to a div that gets called and
updated
   return XML('ajax("%s",[],"song_list");' % URL('default',
'ajax_example.load'))
elif form.errors:
response.flash='Fill the form correctly'
else:
response.flash='Please, fill the form'

return dict(form=form)

*index view
*
{{extend "template.html"}}


 {{=LOAD('default', 'ajax_example.load', ajax=True)}}

*
page_with_form_view
*
{{extend "template.html"}}


 {{=LOAD('default', 'myform.load', ajax=True)}}


*
ajax_example.load
*

{{for song in rows:}}

{{filename, file = db.music2.song.retrieve(song.song)}}
  {{=filename}}

{{pass}}


the last load file just contains a {{=form}}


[web2py] Re: how to avoid (catch) sqllite operational error

2012-07-08 Thread Janath
It worked :) Thank you

On Sunday, July 8, 2012 6:47:59 PM UTC-5, Massimo Di Pierro wrote:
>
> try:
>
> except: #catch all
>db.rollback()
>.
>
> On Sunday, 8 July 2012 17:39:46 UTC-5, Janath wrote:
>>
>> Hi,
>>
>> I populate a database table by a csv file.
>>
>> In run time, if the user tries to upload a file having different format 
>> to the table. A sqllite operational error is detected.
>>
>> In that case I need to inform the user that the file has invalid format.
>>
>> I tried with
>>
>> try:
>> 
>> 
>> except RuntimeError:
>> response.flash='Error'
>> return dict(form=form)
>>
>>
>> I'm unable to catch the error... I have attached the error report
>>
>> Plase advice as to how I can avoid a run time error and display a message 
>> instead.
>>
>> Thank you
>>
>>
>>

[web2py] Re: sending emails from a google account

2012-07-08 Thread Janath
thank you for the email.

It works, with the port number  587.

mail = auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'jana...@gmail.com'
mail.settings.login = 'jana...@gmail.com:mypassword'




On Sunday, July 8, 2012 6:25:15 PM UTC-5, Niphlod wrote:
>
> mail.settings.server = 'logging' just writes if the mail is sent on the 
> console, and it's only for debugging purposes.
>
> You should remove that line and leave only mail.settings.server='
> smtp.gmail.com:465' to actually send any email.
>
> On Monday, July 9, 2012 1:18:49 AM UTC+2, Janath wrote:
>>
>> Hi,
>>
>> I have very limited emails in configuring email servers.
>>
>> I try to used my gmail account to send emails from web2py. 
>>
>> I used the following settings with my specific information 
>> (as mentioned in the web2py book):
>>
>> mail = auth.settings.mailer
>> mail.settings.server = 'smtp.gmail.com:465'
>> mail.settings.sender = 'jana...@gmail.com'
>> mail.settings.login = 'jana...@gmail.com:*mypassword*'
>> mail.settings.server = 'logging'
>>
>>
>> It says mail sent, but I couldnt see it in my account.
>>
>> Is this something doable... If this can be configured in a simple way, I 
>> would appreciate some help.
>>
>> Thank you 
>>
>>
>>
>>

[web2py] Re: please help us test web2py

2012-07-08 Thread Michael Toomim
On Friday, July 6, 2012 6:35:43 PM UTC-7, Massimo Di Pierro wrote:
>
> 2. Remove "Share" link  from welcome app
>> I think we agreed to remove "Share" link because it's not used very much. 
>>
>
> I think we agreed to remove the link to addtoany. Do you really want to 
> remove the share tab at the bottom? I think it can be useful.
>

+1 on removing it...
The internet is covered with too many meaningless share buttons already. It 
looks bad. There's nothing to share in the welcome app.


Re: [web2py] Re: please help us test web2py

2012-07-08 Thread Keith Edmunds
On Sun, 8 Jul 2012 23:31:31 -0700 (PDT), too...@gmail.com said:

> +1 on removing it...
> The internet is covered with too many meaningless share buttons already.

Surely the whole point of the 'welcome' application is to be a scaffolding
to be modified as required? It is much easier for someone new to web2py to
work out how to remove it from their new app than to work out how to add
it if it isn't there.
-- 
We're looking for smart Linux people:
http://www.tiger-computing.co.uk/jobs