Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Michele Comitini
+1



2012/8/1 Luther Goh Lu Feng 

> Hi Massimo:
>
> Looking at http://web2py.com/poweredby it seems that there are both
> examples and derivative projects listed.
>
> A derivative project imho is a site that is based on web2py as its core
> and probably FOSS or installable. I would expect a listing to contain
> projects like
>
> * Muvuca
> * Instant Press
> * web2conf
>
> Other intranet or closed sourced projects should be listed in a separate
> listing, maybe as 'case studies'.
>
> Maybe an example to make it even clearer what a derivative project is:
>
> Symfony 2 is being used by eZ Publish and drupal
> - http://symfony.com/blog/symfony2-meets-drupal-8
> - http://symfony.com/blog/symfony2-meets-ez-publish-5
>
> And Ubuntu has derivatives like Lubuntu, Kubuntu, Edubuntu, Xubuntu etc
>
> Giving such web2py derivative projects visibility could increase awareness
> and therefore increase contribution (I hope!)
>
>
> On Wednesday, August 1, 2012 2:35:40 AM UTC+8, Massimo Di Pierro wrote:
>>
>> Good ones are listed here:
>>
>> http://web2py.com/poweredby
>>
>> Example projects are here:
>>
>> http://web2py.com/appliances
>>
>> The majority of projects are closed source and used in intranets.
>>
>> massimo
>>
>> On Tuesday, 31 July 2012 12:23:22 UTC-5, Luther Goh Lu Feng wrote:
>>>
>>> @Massimo is there a page somewhere listing the projects derived from
>>> web2py? I think maybe one reason is the lack of awareness and visibility of
>>> such web2py derivative projects
>>>
>>> On Tuesday, July 31, 2012 11:51:56 PM UTC+8, Massimo Di Pierro wrote:

 I agree web2py needs a good CMS. The problem is that different people
 expect different things from a CMS. Some time ago I posted code for web2cms
 but nobody has contributed to it. :-(
 Now I am trying put some of that logic into auth.wiki()




 On Tuesday, 31 July 2012 10:21:24 UTC-5, Luther Goh Lu Feng wrote:
>
> I wish to share that imho one of the strengths of web2py is its
> dedication towards backwards compatibility. This is something not
> frequently found in other frameworks, eg in Django or in Drupal.
>
> Therefore, I believe that if a web2py project, be it CMS or otherwise
> gains a sufficient following, it could possibly be very successful.
>
> Just my 5c
>
> On Tuesday, July 31, 2012 9:40:15 PM UTC+8, Mariano Reingart wrote:
>>
>> On Tue, Jul 31, 2012 at 10:08 AM, Mariano Reingart <
>> reing...@gmail.com> wrote:
>> > On Mon, Jul 30, 2012 at 6:13 PM, Tim Michelsen
>> >  wrote:
>> >>> Instant Press is built by @Martin and I dont know if he gets
>> contribution
>> >>> Movu.ca is built by @rochacbruno (me) and I did not get too much
>> >>> contribution (two or 3 people helped with ideas and translations)
>> >>
>> >> Do you think muvuca could be staffed with the features shown in
>> Mezzanine (I
>> >> haven't know it before nor used it):
>> >>
>> >> Hierarchical page navigation
>> >> Save as draft and preview on site
>> >> Scheduled publishing
>> >> Drag-and-drop page ordering
>> >> WYSIWYG editing
>> >> In-line page editing
>> >> Drag-and-drop HTML5 forms builder with CSV export
>> >> SEO friendly URLs and meta data
>> >> Shopping cart module (Cartridge)
>> >> Configurable dashboard widgets
>> >> Blog engine
>> >> Tagging
>> >> User accounts and profiles with email verification
>> >> Translated to over 20 languages
>> >> Sharing via Facebook or Twitter
>> >
>> > Please, take a look at web2conf:
>> >
>> > https://code.google.com/p/**web2conf/
>> >
>> > It has many of your requested features (wyswyg online editor,
>> > navigation bar, user profiles, twitter and blog/rss integration,
>> > schedule/ratings, translations). We are adding something similar to
>> a
>> > shopping cart for the registration system.
>> > Some features are made with plugins and/or are reusable outside the
>> > conference management system.
>> >
>> > If there is enough interest, we could improve and make it a general
>> CMS.
>> > Also, there are many companies and professionals that can be hired
>> to
>> > develop such a project, or contributing to existing ones.
>> > A fundraising would be a good option to start this.
>> >
>>
>> BTW, measuring "community" is difficult.
>>
>> For example, django has a larger community here in Argentina, but
>> earlier web-conference projects like PyCon-Tech failed to gain such
>> traction anyway, and current alternatives are too complex IMHO and
>> needs highly experienced developers.
>>
>> I would also take into consideration maintainability (backward
>> compatibility, all-inclusive real full-stack features, compact code,
>> etc.)
>> Ma

Re: [web2py] Re: Chrome:LOAD and ajax problem

2012-08-01 Thread tomasz bandura
Hello,

My code below:

layout.html:

 {{=LOAD('advert','list.load',ajax=True)}}

advert.py

def list():
   logger.warn('-'*11)
   adverts = db().select(db.advert.id,db.advert.title)
   return dict(adverts=adverts)


list.load

List
{{for adv in adverts:}}
...

And rendered code/beahaviour:

Mozilla Firefox:






List


It works correctly, there are logs in the console.




Chrome:

 1
2
3






During page reload there are a message 'loading...'  for ~1second, and then
div is still empty.
Also there aren't any logs in console.



So i will try to re-create project and check it.


Regards,

Tomasz

2012/7/31 Anthony 

> What do you mean it doesn't work? What happens? Can you show some code?
>
>
> On Tuesday, July 31, 2012 12:01:00 AM UTC-4, tomasz bandura wrote:
>>
>> Hello,
>>
>> I noticed the 'LOAD' function (with Ajax=true) doesn't work under Chrome
>> , when it is used on layout page.
>>
>> Unfortunately Firebug doesn't show an error message, and only response is
>> empty.
>>
>>
>> The same page under Firefox works correctly.
>>
>> Is it any special way to declare LOAD on layout?
>>
>>
>> Best regards,
>> Tomasz
>>
>  --
>
>
>
>

-- 





[web2py] session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=[] unexpected behaviour

2012-08-01 Thread Annet
In my application I build menus based on permissions. When a user logs in I 
set all menus and dropdowns to []

session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=...=[]

Then based on queries I add items to the menus and dropdowns by iterating 
through rows. What happens is, that when I add an item to 
session.cmsadmin_menu it is also added to the other menus and dropdowns, so 
basically all menu items are assigned to all menus and dropdowns because I 
set them to [] in one statement.

To solve this problem I had to set all the menus and dropdowns to [] in 
separate statements:

session.cmsadmin_menu=[]
session.create_dropdown=[]
session.retrieve_dropdown=[]
...=[]

I wonder whether this is also true for variables stored in session and 
variables in general, for I also have this in my code:

session.userNodeID=session.userNodeName=session.userNodeMembership=[]

these session variables get their value elsewhere in the code depending on 
whether their values are present or not.


Kind regards,

Annet.

-- 





Re: [web2py] Re: Chrome:LOAD and ajax problem

2012-08-01 Thread Mery Sole
Gracias por responderme:

Así fue como lo resolví, el siguiente campo lo deje vacio,

campo auth_user.registration_key=empty

Muchas Gracias por responderme

Saludos

2012/8/1 tomasz bandura 

> Hello,
>
> My code below:
>
> layout.html:
>
>  {{=LOAD('advert','list.load',ajax=True)}}
>
> advert.py
>
> def list():
>logger.warn('-'*11)
>adverts = db().select(db.advert.id,db.advert.title)
>return dict(adverts=adverts)
>
>
> list.load
>
> List
> {{for adv in adverts:}}
> ...
>
> And rendered code/beahaviour:
>
> Mozilla Firefox:
>
>
> 
> 
> 
> 
> List
> 
>
> It works correctly, there are logs in the console.
>
>
>
>
> Chrome:
> 
>  1
> 2
> 3
>
> 
>
> 
> 
>
> During page reload there are a message 'loading...'  for ~1second, and
> then div is still empty.
> Also there aren't any logs in console.
>
>
>
> So i will try to re-create project and check it.
>
>
> Regards,
>
> Tomasz
>
> 2012/7/31 Anthony 
>
>> What do you mean it doesn't work? What happens? Can you show some code?
>>
>>
>> On Tuesday, July 31, 2012 12:01:00 AM UTC-4, tomasz bandura wrote:
>>>
>>> Hello,
>>>
>>> I noticed the 'LOAD' function (with Ajax=true) doesn't work under Chrome
>>> , when it is used on layout page.
>>>
>>> Unfortunately Firebug doesn't show an error message, and only response
>>> is empty.
>>>
>>>
>>> The same page under Firefox works correctly.
>>>
>>> Is it any special way to declare LOAD on layout?
>>>
>>>
>>> Best regards,
>>> Tomasz
>>>
>>  --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Mery Sole
Gracias por responderme:

Así fue como lo resolví, el siguiente campo lo deje vacio,

campo auth_user.registration_key=empty

Muchas Gracias por responderme

Saludos

2012/8/1 Michele Comitini 

> +1
>
>
>
> 2012/8/1 Luther Goh Lu Feng 
>
>> Hi Massimo:
>>
>> Looking at http://web2py.com/poweredby it seems that there are both
>> examples and derivative projects listed.
>>
>> A derivative project imho is a site that is based on web2py as its core
>> and probably FOSS or installable. I would expect a listing to contain
>> projects like
>>
>> * Muvuca
>> * Instant Press
>> * web2conf
>>
>> Other intranet or closed sourced projects should be listed in a separate
>> listing, maybe as 'case studies'.
>>
>> Maybe an example to make it even clearer what a derivative project is:
>>
>> Symfony 2 is being used by eZ Publish and drupal
>> - http://symfony.com/blog/symfony2-meets-drupal-8
>> - http://symfony.com/blog/symfony2-meets-ez-publish-5
>>
>> And Ubuntu has derivatives like Lubuntu, Kubuntu, Edubuntu, Xubuntu etc
>>
>> Giving such web2py derivative projects visibility could increase
>> awareness and therefore increase contribution (I hope!)
>>
>>
>> On Wednesday, August 1, 2012 2:35:40 AM UTC+8, Massimo Di Pierro wrote:
>>>
>>> Good ones are listed here:
>>>
>>> http://web2py.com/poweredby
>>>
>>> Example projects are here:
>>>
>>> http://web2py.com/appliances
>>>
>>> The majority of projects are closed source and used in intranets.
>>>
>>> massimo
>>>
>>> On Tuesday, 31 July 2012 12:23:22 UTC-5, Luther Goh Lu Feng wrote:

 @Massimo is there a page somewhere listing the projects derived from
 web2py? I think maybe one reason is the lack of awareness and visibility of
 such web2py derivative projects

 On Tuesday, July 31, 2012 11:51:56 PM UTC+8, Massimo Di Pierro wrote:
>
> I agree web2py needs a good CMS. The problem is that different people
> expect different things from a CMS. Some time ago I posted code for 
> web2cms
> but nobody has contributed to it. :-(
> Now I am trying put some of that logic into auth.wiki()
>
>
>
>
> On Tuesday, 31 July 2012 10:21:24 UTC-5, Luther Goh Lu Feng wrote:
>>
>> I wish to share that imho one of the strengths of web2py is its
>> dedication towards backwards compatibility. This is something not
>> frequently found in other frameworks, eg in Django or in Drupal.
>>
>> Therefore, I believe that if a web2py project, be it CMS or otherwise
>> gains a sufficient following, it could possibly be very successful.
>>
>> Just my 5c
>>
>> On Tuesday, July 31, 2012 9:40:15 PM UTC+8, Mariano Reingart wrote:
>>>
>>> On Tue, Jul 31, 2012 at 10:08 AM, Mariano Reingart <
>>> reing...@gmail.com> wrote:
>>> > On Mon, Jul 30, 2012 at 6:13 PM, Tim Michelsen
>>> >  wrote:
>>> >>> Instant Press is built by @Martin and I dont know if he gets
>>> contribution
>>> >>> Movu.ca is built by @rochacbruno (me) and I did not get too much
>>> >>> contribution (two or 3 people helped with ideas and
>>> translations)
>>> >>
>>> >> Do you think muvuca could be staffed with the features shown in
>>> Mezzanine (I
>>> >> haven't know it before nor used it):
>>> >>
>>> >> Hierarchical page navigation
>>> >> Save as draft and preview on site
>>> >> Scheduled publishing
>>> >> Drag-and-drop page ordering
>>> >> WYSIWYG editing
>>> >> In-line page editing
>>> >> Drag-and-drop HTML5 forms builder with CSV export
>>> >> SEO friendly URLs and meta data
>>> >> Shopping cart module (Cartridge)
>>> >> Configurable dashboard widgets
>>> >> Blog engine
>>> >> Tagging
>>> >> User accounts and profiles with email verification
>>> >> Translated to over 20 languages
>>> >> Sharing via Facebook or Twitter
>>> >
>>> > Please, take a look at web2conf:
>>> >
>>> > https://code.google.com/p/**web2conf/
>>> >
>>> > It has many of your requested features (wyswyg online editor,
>>> > navigation bar, user profiles, twitter and blog/rss integration,
>>> > schedule/ratings, translations). We are adding something similar
>>> to a
>>> > shopping cart for the registration system.
>>> > Some features are made with plugins and/or are reusable outside
>>> the
>>> > conference management system.
>>> >
>>> > If there is enough interest, we could improve and make it a
>>> general CMS.
>>> > Also, there are many companies and professionals that can be hired
>>> to
>>> > develop such a project, or contributing to existing ones.
>>> > A fundraising would be a good option to start this.
>>> >
>>>
>>> BTW, measuring "community" is difficult.
>>>
>>> For example, django has a larger community here in Argentina, but
>>> earlier

Re: [web2py] session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=[] unexpected behaviour

2012-08-01 Thread Mery Sole
Gracias por responderme:

Así fue como lo resolví, el siguiente campo lo deje vacio,

campo auth_user.registration_key=empty

Muchas Gracias por responderme

Saludos


2012/8/1 Annet 

> In my application I build menus based on permissions. When a user logs in
> I set all menus and dropdowns to []
>
>
> session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=...=[]
>
> Then based on queries I add items to the menus and dropdowns by iterating
> through rows. What happens is, that when I add an item to
> session.cmsadmin_menu it is also added to the other menus and dropdowns, so
> basically all menu items are assigned to all menus and dropdowns because I
> set them to [] in one statement.
>
> To solve this problem I had to set all the menus and dropdowns to [] in
> separate statements:
>
> session.cmsadmin_menu=[]
> session.create_dropdown=[]
> session.retrieve_dropdown=[]
> ...=[]
>
> I wonder whether this is also true for variables stored in session and
> variables in general, for I also have this in my code:
>
> session.userNodeID=session.userNodeName=session.userNodeMembership=[]
>
> these session variables get their value elsewhere in the code depending on
> whether their values are present or not.
>
>
> Kind regards,
>
> Annet.
>
> --
>
>
>
>

-- 





Re: [web2py] Re: Recommendations on model file size (database tables)

2012-08-01 Thread Mery Sole
Gracias por responderme:

Así fue como lo resolví, el siguiente campo lo deje vacio,

campo auth_user.registration_key=empty

Muchas Gracias por responderme

Saludos

2012/8/1 Johann Spies 

>  On 31 July 2012 15:50, Anthony  wrote:
>
>> With the -S command line option, you can optionally specify a controller,
>> and even a function.
>>
>> python web2py.py -S akb/default -M -N
>>
>> will give you an environment with the default.py controller exposed, and
>> presumably should run the /models/default/db.py model file. You can also
>> specify -S akb/default/index to run the index function, but in that case
>> you won't remain in the shell -- it will just run the function and return.
>>
>
> Thanks!
>
> Regards
> Johann
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>  --
>
>
>
>

-- 





[web2py] Re: new Auth in trunk

2012-08-01 Thread Sole
Como resuelvo esto:

Tengo un Mensaje que dice: Registration needs verifications, pero la linea 
en db.py  auth.settings.registration_requires_verification = False esta en 
false.
No puedo ingresar con ningun usuario, ni asignar permisos,
>Gracias


On Wednesday, May 13, 2009 11:15:40 PM UTC-3, mdipierro wrote:
>
> Please test this throughly!!! 
>
> I have been working a lot on the Auth in trunk in order to clean up 
> some confusing configuration options. These are the most important 
> ones: 
>
> mail=Mail()  # 
> mailer 
> mail.settings.server='smtp.gmail.com:587'# your SMTP 
> server 
> mail.settings.sender='y...@gmail.com' # your 
> email 
> mail.settings.login='username:password'  # your 
> credentials 
> auth.settings.mailer=mail # for user email 
> verification 
>
> auth.settings.registration_requires_verification = True  # set to 
> False by default 
> auth.settings.registration_requires_approval = True  # set to True by 
> default 
>
> #you MUST write the message for the verificaiton email 
> #since web2py does not know its own URL 
>
> auth.messages.verify_email = 
> \ 
>   'Click on the link http://.../verify_email/%(key)s to verify your 
> email' 
>
> If a registration requires email verification, registration_key is set 
> to a UUID 
> If a registration does not require email verification or has been 
> verfified but it requires approval, registration_key is set to 
> 'pending' 
> If access should be blocked, registration_key can be set manually to 
> 'block'. 
>
> This is a complete list of settings for Auth: 
>
> self.settings.server = 'smtp.gmail.com:587' 
> self.settings.sender = 'y...@google.com' 
> self.settings.login = None  # or 'username:password' 
> self.settings.lock_keys = True 
> self.settings = Settings() 
> self.settings.registration_requires_verification = False 
> self.settings.registration_requires_approval = False 
> self.settings.login_url = URL(r=request, f='user', 
> args='login') 
> self.settings.logged_url = URL(r=request, f='user', 
> args='profile') 
> self.settings.download_url = URL(r=request, f='download') 
> self.settings.mailer = None 
> self.settings.captcha = None 
> self.settings.expiration = 3600  # seconds 
> self.settings.on_failed_authorization = None 
> self.settings.password_field = 'password' 
> self.settings.table_user_name = 'auth_user' 
> self.settings.table_group_name = 'auth_group' 
> self.settings.table_membership_name = 'auth_membership' 
> self.settings.table_permission_name = 'auth_permission' 
> self.settings.table_event_name = 'auth_event' 
> self.settings.table_user = None 
> self.settings.table_group = None 
> self.settings.table_membership = None 
> self.settings.table_permission = None 
> self.settings.table_event = None 
> self.settings.block_registration = False 
> self.settings.register_log = 'User %(id)s Registered' 
> self.settings.login_log = 'User %(id)s Logged-in' 
> self.settings.logout_log = 'User %(id)s Logged-out' 
> self.settings.profile_log = 'User %(id)s Profile updated' 
> self.settings.verify_email_log = \ 
> self.settings.retrieve_username_log = \ 
> self.settings.retrieve_password_log = \ 
> self.settings.change_password_log = \ 
> self.settings.add_group_log = 'Group %(group_id)s created' 
> self.settings.del_group_log = 'Group %(group_id)s deleted' 
> self.settings.add_membership_log = None 
> self.settings.del_membership_log = None 
> self.settings.has_membership_log = None 
> self.settings.add_permission_log = None 
> self.settings.del_permission_log = None 
> self.settings.has_permission_log = None 
> self.settings.showid = False 
> self.settings.login_next = URL(r=request, f='index') 
> self.settings.login_onvalidation = None 
> self.settings.login_onaccept = None 
> self.settings.login_methods = [self] 
> self.settings.register_next = URL(r=request, f='user', 
> args='login') 
> self.settings.register_onvalidation = None 
> self.settings.register_onaccept = None 
> self.settings.verify_email_next = URL(r=request, f='user', 
> args='login') 
> self.settings.verify_email_onvalidation = None 
> self.settings.verify_email_onaccept = None 
> self.settings.submit_button = 'Submit' 
> self.settings.delete_label = 'Check to delete:' 
>
> This is a complete list of messages: 
>
> self.messages.function_disabled = 'Function disabled' 
> self.messages.access_denied = 'Insufficient privileges' 
> self.messages.registration_verifying = 'Registration needs 
> verification' 
> self.messages.registration_pendi

[web2py] Ticket Issued: Unrecoverable

2012-08-01 Thread r13race
Hello,

I made an application using Apache+Web2py+WSGI framework.
It was running fine and all of a sudden as i enter the URL of teh startup 
page it directs me to index.html, it works fine.
There i have a login button as i click it, it issues me a ticket 
"Unrecoverable"
Its not a problem of permissions i have checked.
Can someone help me??

-- 





[web2py] Re: new Auth in trunk

2012-08-01 Thread Alan Etkin

> #you MUST write the message for the verificaiton email 
> #since web2py does not know its own URL 

> auth.messages.verify_email = 
> \ 
>  'Click on the link http://.../verify_email/%(key)
> s to verify your 
> email'

Shouldn't auth.message.verify_email default to something, as expected in a 
standard web2py app? Or it does already?
Why it's not possible to retrieve the verification url with the request 
object?

-- 





[web2py] web2py hangs while creating the mysql tables

2012-08-01 Thread Aurelijus Useckas
Hi, 

I've built the app on SQLite and now want to migrate to the server based 
mysql. BUT web2py hangs in the middle of creating, basicaly just after the 
auth tables. When I restart the apache I can see auth tables as well as a 
few from my app.

this is the err ticket that I get:

(dp1
S'output'
p2
S' (1064, u"You have 
an error in your SQL syntax; check the manual that corresponds to your 
MySQL server version for the right syntax to use near \'long 
VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
ENGINE=InnoDB CHA\' at line 5")'
p3
sS'layer'
p4
S'/opt/web-apps/web2py/applications/init/models/db_comp.py'
p5
sS'code'
p6

thnx

-- 





[web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Aurelijus Useckas
this is the trigger i guess:

db.define_table('maps',
Field('name'),
Field('last_name'),
Field('long'),
Field('lat'),
format='%(name)s')

On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:
>
> Hi, 
>
> I've built the app on SQLite and now want to migrate to the server based 
> mysql. BUT web2py hangs in the middle of creating, basicaly just after the 
> auth tables. When I restart the apache I can see auth tables as well as a 
> few from my app.
>
> this is the err ticket that I get:
>
> (dp1
> S'output'
> p2
> S' (1064, u"You have 
> an error in your SQL syntax; check the manual that corresponds to your 
> MySQL server version for the right syntax to use near \'long 
> VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
> ENGINE=InnoDB CHA\' at line 5")'
> p3
> sS'layer'
> p4
> S'/opt/web-apps/web2py/applications/init/models/db_comp.py'
> p5
> sS'code'
> p6
>
> thnx
>

-- 





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread tomasz bandura
Is it 'long' a mysql's reserved word?

Regards
Tomasz

2012/8/1 Aurelijus Useckas 

> this is the trigger i guess:
>
> db.define_table('maps',
> Field('name'),
> Field('last_name'),
> Field('long'),
> Field('lat'),
> format='%(name)s')
>
> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:
>>
>> Hi,
>>
>> I've built the app on SQLite and now want to migrate to the server based
>> mysql. BUT web2py hangs in the middle of creating, basicaly just after the
>> auth tables. When I restart the apache I can see auth tables as well as a
>> few from my app.
>>
>> this is the err ticket that I get:
>>
>> (dp1
>> S'output'
>> p2
>> S' (1064, u"You
>> have an error in your SQL syntax; check the manual that corresponds to your
>> MySQL server version for the right syntax to use near \'long
>> VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n)
>> ENGINE=InnoDB CHA\' at line 5")'
>> p3
>> sS'layer'
>> p4
>> S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
>> p5
>> sS'code'
>> p6
>>
>> thnx
>>
>  --
>
>
>
>

-- 





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Aurelijus
I really have no clue.. Could it be?

On Wed, Aug 1, 2012 at 3:36 PM, tomasz bandura wrote:

> Is it 'long' a mysql's reserved word?
>
> Regards
> Tomasz
>
> 2012/8/1 Aurelijus Useckas 
>
>> this is the trigger i guess:
>>
>> db.define_table('maps',
>> Field('name'),
>> Field('last_name'),
>> Field('long'),
>> Field('lat'),
>> format='%(name)s')
>>
>> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:
>>>
>>> Hi,
>>>
>>> I've built the app on SQLite and now want to migrate to the server based
>>> mysql. BUT web2py hangs in the middle of creating, basicaly just after the
>>> auth tables. When I restart the apache I can see auth tables as well as a
>>> few from my app.
>>>
>>> this is the err ticket that I get:
>>>
>>> (dp1
>>> S'output'
>>> p2
>>> S' (1064, u"You
>>> have an error in your SQL syntax; check the manual that corresponds to your
>>> MySQL server version for the right syntax to use near \'long
>>> VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n)
>>> ENGINE=InnoDB CHA\' at line 5")'
>>> p3
>>> sS'layer'
>>> p4
>>> S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
>>> p5
>>> sS'code'
>>> p6
>>>
>>>  thnx
>>>
>>  --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread tomasz bandura
Please look at:
http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html  and probably it
causes an error
please try with different field's name.

T.


2012/8/1 Aurelijus 

> I really have no clue.. Could it be?
>
> On Wed, Aug 1, 2012 at 3:36 PM, tomasz bandura 
> wrote:
>
>> Is it 'long' a mysql's reserved word?
>>
>> Regards
>> Tomasz
>>
>> 2012/8/1 Aurelijus Useckas 
>>
>>> this is the trigger i guess:
>>>
>>> db.define_table('maps',
>>> Field('name'),
>>> Field('last_name'),
>>> Field('long'),
>>> Field('lat'),
>>> format='%(name)s')
>>>
>>> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:

 Hi,

 I've built the app on SQLite and now want to migrate to the server
 based mysql. BUT web2py hangs in the middle of creating, basicaly just
 after the auth tables. When I restart the apache I can see auth tables as
 well as a few from my app.

 this is the err ticket that I get:

 (dp1
 S'output'
 p2
 S' (1064,
 u"You have an error in your SQL syntax; check the manual that corresponds
 to your MySQL server version for the right syntax to use near \'long
 VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n)
 ENGINE=InnoDB CHA\' at line 5")'
 p3
 sS'layer'
 p4
 S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
 p5
 sS'code'
 p6

  thnx

>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Aurelijus Useckas
I've changed the long into longitude and it seems to be solved but I still 
get errors:

p2
S' (1005, u"Can\'t 
create table \'./lpkdb/asoc.frm\' (errno: 150)")'

Now it says it cannot create next table, which is:

db.define_table('asoc',
Field('name', label='Pavadinimas', unique=True),
Field('City', db.city, 'list:reference city', label='Miestas'),
Field('address', label='Adresas'),
Field('www'),
Field('tel'),
Field('fax'),
Field('email'),
Field('President', label='Asociacijos prezidentas'),
Field('CEO', label='Asociacijos generalinis'),
Field('CEO_tel', label='Generalinio tel.'),
Field('CEO_email', label='Generalinio email'),
Field('CEO_mob', label='Generalinio mobilus'),
Field('Pres_tel', label='Prezidento tel.'),
Field('Pres_email', label='Prezidento email'),
Field('Pres_mob', label='Prezidento mobilus'),
Field('submited_at', 'datetime', default=request.now, writable=False, 
readable=False),
Field('updated_at', 'datetime', default=request.now, 
update=request.now, writable=False, readable=False),
Field('submited_by', db.auth_user, default=auth.user_id, 
writable=False, readable=False),
Field('updated_by', db.auth_user, update=auth.user_id, writable=False, 
readable=False),
format='%(name)s')

Are there some guidlines on how to construct DAL field names in order to 
avoid any conflict while migrating to mysql?
 

On Wednesday, August 1, 2012 3:36:51 PM UTC+3, tomasz bandura wrote:
>
> Is it 'long' a mysql's reserved word?
>
> Regards
> Tomasz
>
> 2012/8/1 Aurelijus Useckas 
>
>> this is the trigger i guess:
>>
>> db.define_table('maps',
>> Field('name'),
>> Field('last_name'),
>> Field('long'),
>> Field('lat'),
>> format='%(name)s')
>>
>> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:
>>>
>>> Hi, 
>>>
>>> I've built the app on SQLite and now want to migrate to the server based 
>>> mysql. BUT web2py hangs in the middle of creating, basicaly just after the 
>>> auth tables. When I restart the apache I can see auth tables as well as a 
>>> few from my app.
>>>
>>> this is the err ticket that I get:
>>>
>>> (dp1
>>> S'output'
>>> p2
>>> S' (1064, u"You 
>>> have an error in your SQL syntax; check the manual that corresponds to your 
>>> MySQL server version for the right syntax to use near \'long 
>>> VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
>>> ENGINE=InnoDB CHA\' at line 5")'
>>> p3
>>> sS'layer'
>>> p4
>>> S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
>>> p5
>>> sS'code'
>>> p6
>>>
>>> thnx
>>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





Re: [web2py] Re: Chrome:LOAD and ajax problem

2012-08-01 Thread Anthony

>
> Chrome:
> 
>  1
> 2
> 3
>
> 
>
> 
> 
>
> During page reload there are a message 'loading...'  for ~1second, and 
> then div is still empty.
> Also there aren't any logs in console.
>

Are you saying the div does load properly when the page first loads, but 
the problem only occurs when the page reloads? Or does it not load at all? 
I cannot reproduce the problem. Are you sure web2py.js has loaded, and have 
you made any changes to web2py.js? Do you see any Javascript errors in the 
Chrome console? It might help to show all the view code (layout.html as 
well as a view that is included in it).

Anthony

-- 





[web2py] Re: Possible scheduler bug, stable version

2012-08-01 Thread Tim Richardson


On Wednesday, 1 August 2012 01:36:51 UTC+10, Niphlod wrote:
>
> uhm. try the trunk version remains a valid point.
> Anyway, are you aware that results are json encoded (so to read back them 
> into python dictionary you have to do simplejson.loads(results)) ?
>
 
Wasn't. Thanks.

And will try the trunk version in parallel to my almost-live app in coming 
days. 

 

>
>
> Il giorno martedì 31 luglio 2012 13:11:32 UTC+2, Tim Richardson ha scritto:
>>
>> My scheduled task returns a dictionary which is serialized and stored in 
>> the scheduler_run table in the result column.
>> The dictionary is actually a dictionary of dictionaries, only one level 
>> deep. I used eval to recover the original dict. 
>> Oddly True and False values are serialised as true and false (lowercase). 
>> They don't eval back since true and false are not defined. I've worked 
>> around this by assigning true = True, false = False and then doing eval. I 
>> don't know enough about Python to tell if this is my fault somehow. 
>
>

-- 





[web2py] Re: session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=[] unexpected behaviour

2012-08-01 Thread Anthony
Yes, all those variables are pointing to the same object in memory (the 
list). If you just mutate the list, they're all still pointing to that same 
list. If you completely re-assign one of the variables to a different 
object, then that won't affect the other variables (which will still refer 
to the list). This might help: 
http://inst.eecs.berkeley.edu/~selfpace/cs9honline/Q2/mutation.html.

Anthony

On Wednesday, August 1, 2012 4:11:55 AM UTC-4, Annet wrote:
>
> In my application I build menus based on permissions. When a user logs in 
> I set all menus and dropdowns to []
>
>
> session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=...=[]
>
> Then based on queries I add items to the menus and dropdowns by iterating 
> through rows. What happens is, that when I add an item to 
> session.cmsadmin_menu it is also added to the other menus and dropdowns, so 
> basically all menu items are assigned to all menus and dropdowns because I 
> set them to [] in one statement.
>
> To solve this problem I had to set all the menus and dropdowns to [] in 
> separate statements:
>
> session.cmsadmin_menu=[]
> session.create_dropdown=[]
> session.retrieve_dropdown=[]
> ...=[]
>
> I wonder whether this is also true for variables stored in session and 
> variables in general, for I also have this in my code:
>
> session.userNodeID=session.userNodeName=session.userNodeMembership=[]
>
> these session variables get their value elsewhere in the code depending on 
> whether their values are present or not.
>
>
> Kind regards,
>
> Annet.
>

-- 





Re: [web2py] Ticket Issued: Unrecoverable

2012-08-01 Thread Richard Vézina
I am pretty sure that some of your app files permissions are not correctly
setted.

chown www-data.www-data -R web2py/applications/yourapp

Richard

On Wed, Aug 1, 2012 at 4:36 AM, r13race  wrote:

> Hello,
>
> I made an application using Apache+Web2py+WSGI framework.
> It was running fine and all of a sudden as i enter the URL of teh startup
> page it directs me to index.html, it works fine.
> There i have a login button as i click it, it issues me a ticket
> "Unrecoverable"
> Its not a problem of permissions i have checked.
> Can someone help me??
>
> --
>
>
>
>

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Massimo Di Pierro
So perhaps poweredby apps should have a flag and flagged apps should always 
be on top. 

On Tuesday, 31 July 2012 21:00:39 UTC-5, Luther Goh Lu Feng wrote:
>
> Hi Massimo:
>
> Looking at http://web2py.com/poweredby it seems that there are both 
> examples and derivative projects listed.
>
> A derivative project imho is a site that is based on web2py as its core 
> and probably FOSS or installable. I would expect a listing to contain 
> projects like 
>
> * Muvuca 
> * Instant Press 
> * web2conf 
>
> Other intranet or closed sourced projects should be listed in a separate 
> listing, maybe as 'case studies'.
>
> Maybe an example to make it even clearer what a derivative project is:
>
> Symfony 2 is being used by eZ Publish and drupal
> - http://symfony.com/blog/symfony2-meets-drupal-8
> - http://symfony.com/blog/symfony2-meets-ez-publish-5
>
> And Ubuntu has derivatives like Lubuntu, Kubuntu, Edubuntu, Xubuntu etc
>
> Giving such web2py derivative projects visibility could increase awareness 
> and therefore increase contribution (I hope!)
>
>
> On Wednesday, August 1, 2012 2:35:40 AM UTC+8, Massimo Di Pierro wrote:
>>
>> Good ones are listed here:
>>
>> http://web2py.com/poweredby
>>
>> Example projects are here:
>>
>> http://web2py.com/appliances
>>
>> The majority of projects are closed source and used in intranets.
>>
>> massimo
>>
>> On Tuesday, 31 July 2012 12:23:22 UTC-5, Luther Goh Lu Feng wrote:
>>>
>>> @Massimo is there a page somewhere listing the projects derived from 
>>> web2py? I think maybe one reason is the lack of awareness and visibility of 
>>> such web2py derivative projects
>>>
>>> On Tuesday, July 31, 2012 11:51:56 PM UTC+8, Massimo Di Pierro wrote:

 I agree web2py needs a good CMS. The problem is that different people 
 expect different things from a CMS. Some time ago I posted code for 
 web2cms 
 but nobody has contributed to it. :-(
 Now I am trying put some of that logic into auth.wiki()




 On Tuesday, 31 July 2012 10:21:24 UTC-5, Luther Goh Lu Feng wrote:
>
> I wish to share that imho one of the strengths of web2py is its 
> dedication towards backwards compatibility. This is something not 
> frequently found in other frameworks, eg in Django or in Drupal.
>
> Therefore, I believe that if a web2py project, be it CMS or otherwise 
> gains a sufficient following, it could possibly be very successful.
>
> Just my 5c
>
> On Tuesday, July 31, 2012 9:40:15 PM UTC+8, Mariano Reingart wrote:
>>
>> On Tue, Jul 31, 2012 at 10:08 AM, Mariano Reingart <
>> reing...@gmail.com> wrote: 
>> > On Mon, Jul 30, 2012 at 6:13 PM, Tim Michelsen 
>> >  wrote: 
>> >>> Instant Press is built by @Martin and I dont know if he gets 
>> contribution 
>> >>> Movu.ca is built by @rochacbruno (me) and I did not get too much 
>> >>> contribution (two or 3 people helped with ideas and translations) 
>> >> 
>> >> Do you think muvuca could be staffed with the features shown in 
>> Mezzanine (I 
>> >> haven't know it before nor used it): 
>> >> 
>> >> Hierarchical page navigation 
>> >> Save as draft and preview on site 
>> >> Scheduled publishing 
>> >> Drag-and-drop page ordering 
>> >> WYSIWYG editing 
>> >> In-line page editing 
>> >> Drag-and-drop HTML5 forms builder with CSV export 
>> >> SEO friendly URLs and meta data 
>> >> Shopping cart module (Cartridge) 
>> >> Configurable dashboard widgets 
>> >> Blog engine 
>> >> Tagging 
>> >> User accounts and profiles with email verification 
>> >> Translated to over 20 languages 
>> >> Sharing via Facebook or Twitter 
>> > 
>> > Please, take a look at web2conf: 
>> > 
>> > https://code.google.com/p/web2conf/ 
>> > 
>> > It has many of your requested features (wyswyg online editor, 
>> > navigation bar, user profiles, twitter and blog/rss integration, 
>> > schedule/ratings, translations). We are adding something similar to 
>> a 
>> > shopping cart for the registration system. 
>> > Some features are made with plugins and/or are reusable outside the 
>> > conference management system. 
>> > 
>> > If there is enough interest, we could improve and make it a general 
>> CMS. 
>> > Also, there are many companies and professionals that can be hired 
>> to 
>> > develop such a project, or contributing to existing ones. 
>> > A fundraising would be a good option to start this. 
>> > 
>>
>> BTW, measuring "community" is difficult. 
>>
>> For example, django has a larger community here in Argentina, but 
>> earlier web-conference projects like PyCon-Tech failed to gain such 
>> traction anyway, and current alternatives are too complex IMHO and 
>> needs highly experienced developers. 
>>
>> I w

Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Massimo Di Pierro
db = DAL('mysql://', check_reserved=['common','mysql'])

Anyway, I am not sure your problem is that you are using  a reserved 
keyword. Perhaps the table exists already. I am also surprised you are 
getting a pymysql InternalError and not an OperationalError.

On Wednesday, 1 August 2012 07:45:01 UTC-5, Aurelijus Useckas wrote:
>
> I've changed the long into longitude and it seems to be solved but I still 
> get errors:
>
> p2
> S' (1005, u"Can\'t 
> create table \'./lpkdb/asoc.frm\' (errno: 150)")'
>
> Now it says it cannot create next table, which is:
>
> db.define_table('asoc',
> Field('name', label='Pavadinimas', unique=True),
> Field('City', db.city, 'list:reference city', label='Miestas'),
> Field('address', label='Adresas'),
> Field('www'),
> Field('tel'),
> Field('fax'),
> Field('email'),
> Field('President', label='Asociacijos prezidentas'),
> Field('CEO', label='Asociacijos generalinis'),
> Field('CEO_tel', label='Generalinio tel.'),
> Field('CEO_email', label='Generalinio email'),
> Field('CEO_mob', label='Generalinio mobilus'),
> Field('Pres_tel', label='Prezidento tel.'),
> Field('Pres_email', label='Prezidento email'),
> Field('Pres_mob', label='Prezidento mobilus'),
> Field('submited_at', 'datetime', default=request.now, writable=False, 
> readable=False),
> Field('updated_at', 'datetime', default=request.now, 
> update=request.now, writable=False, readable=False),
> Field('submited_by', db.auth_user, default=auth.user_id, 
> writable=False, readable=False),
> Field('updated_by', db.auth_user, update=auth.user_id, writable=False, 
> readable=False),
> format='%(name)s')
>
> Are there some guidlines on how to construct DAL field names in order to 
> avoid any conflict while migrating to mysql?
>  
>
> On Wednesday, August 1, 2012 3:36:51 PM UTC+3, tomasz bandura wrote:
>>
>> Is it 'long' a mysql's reserved word?
>>
>> Regards
>> Tomasz
>>
>> 2012/8/1 Aurelijus Useckas 
>>
>>> this is the trigger i guess:
>>>
>>> db.define_table('maps',
>>> Field('name'),
>>> Field('last_name'),
>>> Field('long'),
>>> Field('lat'),
>>> format='%(name)s')
>>>
>>> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:

 Hi, 

 I've built the app on SQLite and now want to migrate to the server 
 based mysql. BUT web2py hangs in the middle of creating, basicaly just 
 after the auth tables. When I restart the apache I can see auth tables as 
 well as a few from my app.

 this is the err ticket that I get:

 (dp1
 S'output'
 p2
 S' (1064, 
 u"You have an error in your SQL syntax; check the manual that corresponds 
 to your MySQL server version for the right syntax to use near \'long 
 VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
 ENGINE=InnoDB CHA\' at line 5")'
 p3
 sS'layer'
 p4
 S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
 p5
 sS'code'
 p6

 thnx

>>>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>

-- 





[web2py] Re: Making part of User's Profile public - viewable by anyone with url

2012-08-01 Thread Massimo Di Pierro
If you want to sue this URL:
http://127.0.0.1:8000/ProfilePublic/~jsmith

routes should be like this:

# begin
routes_in = [
   ('/ProfilePublic/~$anything','/ProfilePublic/default/userinfo/$anything'
),
]
#end
routes_out = [
   ('/ProfilePublic/default/userinfo/$anything','/ProfilePublic/~$anything'
),
]

On Tuesday, 31 July 2012 17:21:42 UTC-5, Rob_McC wrote:
>
> Sir:
>
> Any ideas? Where I'm going wrong?
>
> Just trying to get the routing working, as per your instructions.
>
> http://127.0.0.1:8000/ProfilePublic/~jsmith
> returns 
> *invalid request
> *
> I'm on Max OX,
> I open the Package Contents. (see screen shot) and place routes
> I saw the example routing files there as well, so I assume that is where 
> it goes,
> I would sort of expected the routes.py file to be inside the application 
> directory.
>
> *Here is my routes.py file*
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
>
> # default_application, default_controller, default_function
> # are used when the respective element is missing from the
> # (possibly rewritten) incoming URL
>
>
> # begin
> routes_in = [
>('/~/$anything','/app/default/userinfo/$anything'),
> ]
> #end
> routes_out = [
>('/app/default/userinfo/$anything','/~/$anything'),
> ]
>
>
>
> Thanks once again.
>
> Rob
>
>
>
>
>
> On Tuesday, July 31, 2012 4:13:08 PM UTC-4, Massimo Di Pierro wrote:
>>
>> ...
>>
>> Using a Twitter like syntax you can try create a web2py/routes.py file:
>>
>> # begin
>> routes_in = [
>>('/~/$anything','/app/default/userinfo/$anything'),
>> ]
>> #end
>> routes_out = [
>>('/app/default/userinfo/$anything','/~/$anything'),
>> ]
>>
>> and use http://hostname/~jsmith
>>
>> The ~ will help you avoid confusion between a username and a web2py 
>> app-name.
>>
>> On Tuesday, July 31, 2012 2:11:47 PM UTC-5, Rob_McC wrote:
>>>
>>> Haven't been able to find a solution to this on Groups - I'm NEW to 
>>> web2py, but enjoying it a great deal.
>>>
>>> Note: I learned how to make custom fields in User's table, that was easy.
>>>
>>> *Assumptions*:
>>> *User: jsmith
>>> Custom fields:  Country, Age
>>>Country=Canada
>>>Age=34*
>>>
>>> I want to make a few of the user's profile public - no login is required 
>>> to view SOME of the fields
>>>
>>> I know if jsmith is logged in,  he can access only his profile at:
>>> *http://somesocialwebsite/default/user/profile*
>>>
>>> *Question/problem:*
>>>
>>> *How do I make a public url like:
>>> **
>>> http://somesocialwebsite/jsmith*
>>>
>>> *return
>>> *
>>> *
>>> *
>>> *Some Social Website
>>> User Name: jsmith
>>> Age: 34
>>> Country: Canada* 
>>> *
>>> *
>>>
>>> Any help, or pointing me in the right direction would be appreciated, 
>>> thanks,
>>>
>>> Rob
>>>
>>> Reference: Adding custom fields
>>>
>>> https://groups.google.com/forum/?fromgroups#!searchin/web2py/db.auth_user$20adding$20fields/web2py/H0g7WUV7ubg/7AxpjU_tFL8J
>>>
>>>
>>>
>>>
>>>
>>>
>>>

-- 





Re: [web2py] Ticket Issued: Unrecoverable

2012-08-01 Thread Massimo Di Pierro
chown www-data:www-data -R web2py/applications/


On Wednesday, 1 August 2012 08:47:23 UTC-5, Richard wrote:
>
> I am pretty sure that some of your app files permissions are not correctly 
> setted. 
>
> chown www-data.www-data -R web2py/applications/yourapp
>
> Richard
>
> On Wed, Aug 1, 2012 at 4:36 AM, r13race  wrote:
>
>> Hello,
>>
>> I made an application using Apache+Web2py+WSGI framework.
>> It was running fine and all of a sudden as i enter the URL of teh startup 
>> page it directs me to index.html, it works fine.
>> There i have a login button as i click it, it issues me a ticket 
>> "Unrecoverable"
>> Its not a problem of permissions i have checked.
>> Can someone help me??
>>
>> -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Web2py site/app with several deily accesses

2012-08-01 Thread vinicius...@gmail.com
This question has been asked here from time to time, but always things 
get up to date.


So, do you have some case using web2py to serve several (hundreds of 
thousands, or millions) page hits a day?


What is your app architecture? Model based? Modelless?
What database do you use?

Tell us something about it.

--
Vinicius Assef

--





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Aurelijus Useckas
Thank you Massimo, but the 1005/150 mysql problem seems to be smth wring 
with foreign key (merging of tables). Are there any flaws in my DAL syntax? 

This line seems to be the trigger:
Field('City', db.city, 'list:reference city', label='Miestas'),

it references:

db.define_table('city',
Field('name', notnull=True, unique=True),
format='%(name)s')

any ideas what's bothering mysql? 


On Wednesday, August 1, 2012 4:56:03 PM UTC+3, Massimo Di Pierro wrote:
>
> db = DAL('mysql://', check_reserved=['common','mysql'])
>
> Anyway, I am not sure your problem is that you are using  a reserved 
> keyword. Perhaps the table exists already. I am also surprised you are 
> getting a pymysql InternalError and not an OperationalError.
>
> On Wednesday, 1 August 2012 07:45:01 UTC-5, Aurelijus Useckas wrote:
>>
>> I've changed the long into longitude and it seems to be solved but I 
>> still get errors:
>>
>> p2
>> S' (1005, u"Can\'t 
>> create table \'./lpkdb/asoc.frm\' (errno: 150)")'
>>
>> Now it says it cannot create next table, which is:
>>
>> db.define_table('asoc',
>> Field('name', label='Pavadinimas', unique=True),
>> Field('City', db.city, 'list:reference city', label='Miestas'),
>> Field('address', label='Adresas'),
>> Field('www'),
>> Field('tel'),
>> Field('fax'),
>> Field('email'),
>> Field('President', label='Asociacijos prezidentas'),
>> Field('CEO', label='Asociacijos generalinis'),
>> Field('CEO_tel', label='Generalinio tel.'),
>> Field('CEO_email', label='Generalinio email'),
>> Field('CEO_mob', label='Generalinio mobilus'),
>> Field('Pres_tel', label='Prezidento tel.'),
>> Field('Pres_email', label='Prezidento email'),
>> Field('Pres_mob', label='Prezidento mobilus'),
>> Field('submited_at', 'datetime', default=request.now, writable=False, 
>> readable=False),
>> Field('updated_at', 'datetime', default=request.now, 
>> update=request.now, writable=False, readable=False),
>> Field('submited_by', db.auth_user, default=auth.user_id, 
>> writable=False, readable=False),
>> Field('updated_by', db.auth_user, update=auth.user_id, 
>> writable=False, readable=False),
>> format='%(name)s')
>>
>> Are there some guidlines on how to construct DAL field names in order to 
>> avoid any conflict while migrating to mysql?
>>  
>>
>> On Wednesday, August 1, 2012 3:36:51 PM UTC+3, tomasz bandura wrote:
>>>
>>> Is it 'long' a mysql's reserved word?
>>>
>>> Regards
>>> Tomasz
>>>
>>> 2012/8/1 Aurelijus Useckas 
>>>
 this is the trigger i guess:

 db.define_table('maps',
 Field('name'),
 Field('last_name'),
 Field('long'),
 Field('lat'),
 format='%(name)s')

 On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:
>
> Hi, 
>
> I've built the app on SQLite and now want to migrate to the server 
> based mysql. BUT web2py hangs in the middle of creating, basicaly just 
> after the auth tables. When I restart the apache I can see auth tables as 
> well as a few from my app.
>
> this is the err ticket that I get:
>
> (dp1
> S'output'
> p2
> S' (1064, 
> u"You have an error in your SQL syntax; check the manual that corresponds 
> to your MySQL server version for the right syntax to use near \'long 
> VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
> ENGINE=InnoDB CHA\' at line 5")'
> p3
> sS'layer'
> p4
> S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
> p5
> sS'code'
> p6
>
> thnx
>
  -- 
  
  
  

>>>
>>>

-- 





[web2py] Re: Centos 5 script for Nginx with Uwsgi and Web2py

2012-08-01 Thread peter
 The instructions I gave at the top had been tested on a bare centos 5 
machine and worked. 

I have got through 5 issues on your instructions so far:


'force-reload' not recognised so removed from uwsgi

 

'tar's had '-zxvf' as options, changed to 'zxvf'

 

'cp -R ./$version/* /opt/uwsgi-python/*'

changed to 

'cp -R ./$version/* /opt/uwsgi-python'

after 

"cd /opt/uwsgi-python

echo 'build using python 2.7'
python2.7 setup.py build"

I get ImportError no module named setuptools.

Any ideas why you did not get this error?

Peter

On Sunday, 29 July 2012 15:26:37 UTC+1, Alan Etkin wrote:
>
> The fixed peter scrip to install Python 2.7.3 and self-signed certs for 
> ssl enabled apps. It retrieves the base architecture also for nginx 
> installation. It should be tested although, as I only used its commands 
> separately.
>
>

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Michele Comitini
Massimo,

Why not put open source  or commercial (products that are on sale) software
programs  in a different section?
"built on web2py" is different from "made with web2py" IMHO.
This of course could be not the best way to present things,
marketing/communication is not my field.
The important thing is to give the idea,  to anyone that want to start a
software project that can be distributed, that web2py is the best platform
for the job! ;-)

mic


2012/8/1 Massimo Di Pierro 

> So perhaps poweredby apps should have a flag and flagged apps should
> always be on top.
>
>
> On Tuesday, 31 July 2012 21:00:39 UTC-5, Luther Goh Lu Feng wrote:
>>
>> Hi Massimo:
>>
>> Looking at http://web2py.com/poweredby** it seems that there are both
>> examples and derivative projects listed.
>>
>> A derivative project imho is a site that is based on web2py as its core
>> and probably FOSS or installable. I would expect a listing to contain
>> projects like
>>
>> * Muvuca
>> * Instant Press
>> * web2conf
>>
>> Other intranet or closed sourced projects should be listed in a separate
>> listing, maybe as 'case studies'.
>>
>> Maybe an example to make it even clearer what a derivative project is:
>>
>> Symfony 2 is being used by eZ Publish and drupal
>> - 
>> http://symfony.com/blog/**symfony2-meets-drupal-8
>> - 
>> http://symfony.com/blog/**symfony2-meets-ez-publish-5
>>
>> And Ubuntu has derivatives like Lubuntu, Kubuntu, Edubuntu, Xubuntu etc
>>
>> Giving such web2py derivative projects visibility could increase
>> awareness and therefore increase contribution (I hope!)
>>
>>
>> On Wednesday, August 1, 2012 2:35:40 AM UTC+8, Massimo Di Pierro wrote:
>>>
>>> Good ones are listed here:
>>>
>>> http://web2py.com/poweredby
>>>
>>> Example projects are here:
>>>
>>> http://web2py.com/appliances
>>>
>>> The majority of projects are closed source and used in intranets.
>>>
>>> massimo
>>>
>>> On Tuesday, 31 July 2012 12:23:22 UTC-5, Luther Goh Lu Feng wrote:

 @Massimo is there a page somewhere listing the projects derived from
 web2py? I think maybe one reason is the lack of awareness and visibility of
 such web2py derivative projects

 On Tuesday, July 31, 2012 11:51:56 PM UTC+8, Massimo Di Pierro wrote:
>
> I agree web2py needs a good CMS. The problem is that different people
> expect different things from a CMS. Some time ago I posted code for 
> web2cms
> but nobody has contributed to it. :-(
> Now I am trying put some of that logic into auth.wiki()
>
>
>
>
> On Tuesday, 31 July 2012 10:21:24 UTC-5, Luther Goh Lu Feng wrote:
>>
>> I wish to share that imho one of the strengths of web2py is its
>> dedication towards backwards compatibility. This is something not
>> frequently found in other frameworks, eg in Django or in Drupal.
>>
>> Therefore, I believe that if a web2py project, be it CMS or otherwise
>> gains a sufficient following, it could possibly be very successful.
>>
>> Just my 5c
>>
>> On Tuesday, July 31, 2012 9:40:15 PM UTC+8, Mariano Reingart wrote:
>>>
>>> On Tue, Jul 31, 2012 at 10:08 AM, Mariano Reingart <
>>> reing...@gmail.com> wrote:
>>> > On Mon, Jul 30, 2012 at 6:13 PM, Tim Michelsen
>>> >  wrote:
>>> >>> Instant Press is built by @Martin and I dont know if he gets
>>> contribution
>>> >>> Movu.ca is built by @rochacbruno (me) and I did not get too much
>>> >>> contribution (two or 3 people helped with ideas and
>>> translations)
>>> >>
>>> >> Do you think muvuca could be staffed with the features shown in
>>> Mezzanine (I
>>> >> haven't know it before nor used it):
>>> >>
>>> >> Hierarchical page navigation
>>> >> Save as draft and preview on site
>>> >> Scheduled publishing
>>> >> Drag-and-drop page ordering
>>> >> WYSIWYG editing
>>> >> In-line page editing
>>> >> Drag-and-drop HTML5 forms builder with CSV export
>>> >> SEO friendly URLs and meta data
>>> >> Shopping cart module (Cartridge)
>>> >> Configurable dashboard widgets
>>> >> Blog engine
>>> >> Tagging
>>> >> User accounts and profiles with email verification
>>> >> Translated to over 20 languages
>>> >> Sharing via Facebook or Twitter
>>> >
>>> > Please, take a look at web2conf:
>>> >
>>> > https://code.google.com/p/**web2conf/
>>> >
>>> > It has many of your requested features (wyswyg online editor,
>>> > navigation bar, user profiles, twitter and blog/rss integration,
>>> > schedule/ratings, translations). We are adding something similar
>>> to a
>>> > shopping cart for the registration system.
>>> > Some features are made with plugins and/or are reusable outside
>>> the

[web2py] Re: Django vs. Web2py

2012-08-01 Thread yamandu
Wow, we could have a presentation like that http://www.silverstripe.org/

Em segunda-feira, 30 de julho de 2012 09h02min56s UTC-3, Gour escreveu:
>
> On Mon, 30 Jul 2012 21:45:15 +1000 
> Alec Taylor  
> wrote: 
>
> > If I wasn't working on a separate sizable web2py project (a 
> > social-network) then I'd build this (a CMS) with specifications 
> > similar to Mezzanine. 
>
> Nice to hear. 
>
> > But hold on a month or two, and you'll see fairly similar features in 
> > my social-network + more. 
>
> Well, I'm afraid that it will be another one-man project without much 
> community around it. 
>
> I'll try & play with Mezzanine to get a feel for it, but I might 
> reconsider web2py at a later point in time. 
>
>
> Still, I'm interested why there are not more CMS/blog apps written in 
> web2py...maybe that is niche market for this framework... 
>
>
> Sincerely, 
> Gour 
>
> -- 
> From wherever the mind wanders due to its flickering and unsteady 
> nature, one must certainly withdraw it and bring it back under 
> the control of the self. 
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 
>

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Anthony
On Wednesday, August 1, 2012 9:50:07 AM UTC-4, Massimo Di Pierro wrote:
>
> So perhaps poweredby apps should have a flag and flagged apps should 
> always be on top. 
>

That is already the case, though we don't make a distinction between 
 "examples" and "derivative projects" for that purpose.

Anthony

-- 





[web2py] Re: Ticket Issued: Unrecoverable

2012-08-01 Thread AbrahamLinksys
Are 100% sure it's not permissions (e.g. you've run chmod recursively on 
the root of your app)?

If so, I've also seen this error when mod_wsgi is misconfigured. In my 
case, I was able to visit one application (which was the default_app set in 
routers.BASE) but visiting the other resulted in the unrecoverable ticket. 
Maybe it was something to do with the applications' contexts becoming 
mixed... I'm really not sure. 

Are you running more than one application? If so, you might want to 
troubleshoot your mod_wsgi setup, try turning one app off, etc. If you're 
running a single app, then I'm not sure... maybe check the apache config, 
ensure you're setting the right user and group to the wsgi daemon process 
as it could still be a permissions issue in that way... although it's 
curious that your app suddenly started creating 'unrecoverable' tickets.

I'm sure you're restarted apache and possibly the machine to make sure it's 
not just weirdness?

-Colin

On Wednesday, August 1, 2012 3:36:21 AM UTC-5, r13race wrote:
>
> Hello,
>
> I made an application using Apache+Web2py+WSGI framework.
> It was running fine and all of a sudden as i enter the URL of teh startup 
> page it directs me to index.html, it works fine.
> There i have a login button as i click it, it issues me a ticket 
> "Unrecoverable"
> Its not a problem of permissions i have checked.
> Can someone help me??
>

-- 





[web2py] existing tables in plugin_wiki

2012-08-01 Thread Larry Wapnitsky
I'm attempting to access database tables created in my db.py file using 
different aspects of plugin_wiki.  Whenever I enter the table name, I get 
the following as my results on my "page":

Traceback (most recent call last):
  File 
"/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", line 
631, in render_widget
args = dict((item[0].strip(), self.parse_value(item[1].strip())) for item 
in items)
  File 
"/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", line 
631, in 
args = dict((item[0].strip(), self.parse_value(item[1].strip())) for item 
in items)
IndexError: list index out of range


Here is the code on the wiki page that was generated by the builder:
``
name: read
table: message
record_id: id
``:widget

Thanks

-- 





[web2py] Web2py in apache mod_wsgi with virtualenv

2012-08-01 Thread Daniel Gonzalez
Hi,

I am deploying a web2py application, and I will be serving it with Apache 
via mod_wsgi. I have the following WSGI directives in my virtual host 
configuration:

WSGIDaemonProcess web2py user=www-data group=www-data \
display-name=%{GROUP}
WSGIProcessGroup web2py
WSGIScriptAlias / /var/www/web2py/wsgihandler.py


This is working, but it is taking the system wide python installation. As a 
result, some packages are not found (since they are only present in my 
virtualenv). I would like to tell this particular virtual host (or the 
whole Apache, if there is no other way), to use the python installation in 
my virtual environment (/home/myuser/.virtualenvs/python2.7.2/bin).

Is it possible to configure this for Apache? Or better, just for my virtual 
host? I would like to cause as little effect as possible to the rest of the 
system (specifically, I do not want to modify the default python version 
used system wide)


I have tried different things, like:

Adding the following to wsgihandler.py:

activate_this = '/path/to/virtualenv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this)
import sys
sys.path.insert(0, '/path/to/web2py_dir')



Also, modififying the /etc/init.d/apache2 script, adding the following:

ENV="env -i LANG=C 
PATH=/home/myuser/.virtualenvs/python2.7.2/bin:/usr/local/bin:/usr/bin:/bin"
export PATH="/home/myuser/.virtualenvs/python2.7.2/bin:$PATH"
python -V

Strangely enough, the python -V shows that the right python binary is 
active (the one in the virtualenv, 2.7.2), but web2py, in the error 
reports, is showing the following:

web2py™ (2, 0, 0, datetime.datetime(2012, 7, 1, 22, 43, 58), 'dev')
Python Python 2.6.5: /home/myuser/.virtualenvs/python2.7.2/bin/python

So is it using 2.6.5 or 2.7.2? The python installed 
in /home/myuser/.virtualenvs/python2.7.2/bin/python *is* 2.7.2.

What I need is to use the virtualenv *and* python 2.7.2, which is not the 
system-wide python, but the one in the virtualenv.

Do you have any suggestions?

Thanks,
Daniel

-- 





[web2py] format attribute in Record Representation

2012-08-01 Thread lyn2py


I refer to http://web2py.com/books/default/chapter/29/6 under Record 
representation

> The format attribute will be used for two purposes:
>
>- To represent referenced records in select/option drop-downs.
>
>
>- To set the db.othertable.person.represent attribute for all fields 
>referencing this table. This means that SQLTABLE will not show references 
>by id but will use the format preferred representation instead.
>
>

   1. I have specified the format but it doesn't appear per the format (in 
   appadmin, when listing table records). I have restarted the server (just in 
   case) but it still references the ID rather than the specified format. Any 
   ideas?
   2. It also doesn't appear so in the drop down menus (again, all appear 
   as IDs). I had to separately specify the format for the drop down menus. Is 
   it supposed to work this way? It doesn't seem like it based on the above 
   explanation.

Please help. Thanks!

-- 





[web2py] Re: format attribute in Record Representation

2012-08-01 Thread Anthony
Have you explicitly set any validators for the field (e.g., IS_IN_DB)? I 
believe you only get the default represent attribute when you don't 
explicitly set a validator (perhaps that should be changed).

Anthony

On Wednesday, August 1, 2012 11:17:24 AM UTC-4, lyn2py wrote:
>
> I refer to http://web2py.com/books/default/chapter/29/6 under Record 
> representation
>
>> The format attribute will be used for two purposes:
>>
>>- To represent referenced records in select/option drop-downs.
>>
>>
>>- To set the db.othertable.person.represent attribute for all fields 
>>referencing this table. This means that SQLTABLE will not show references 
>>by id but will use the format preferred representation instead.
>>
>>
>
>1. I have specified the format but it doesn't appear per the format 
>(in appadmin, when listing table records). I have restarted the server 
>(just in case) but it still references the ID rather than the specified 
>format. Any ideas?
>2. It also doesn't appear so in the drop down menus (again, all appear 
>as IDs). I had to separately specify the format for the drop down menus. 
> Is 
>it supposed to work this way? It doesn't seem like it based on the above 
>explanation.
>
> Please help. Thanks!
>
>

-- 





[web2py] Re: session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=[] unexpected behaviour

2012-08-01 Thread Annet
Hi Anthony,

This might help: 
> http://inst.eecs.berkeley.edu/~selfpace/cs9honline/Q2/mutation.html.


That was helpful.

As you know I am working on a network application, which is node i.e nodeID 
driven. When nodeID's change I need a way to reset all variable's stored in 
session, to use them in conditionals to test if they are False or in order 
to assign new values to them.

session.userNodeID gets assigned an id, session.userNodeName a string and 
session.userNodeMembership a list, just like the menu and dropdown 
variables. So I'd better do the following:

session.userNodeID=0
session.userNodeName=''
session.userNodeMembership=[]
session.cmsadmin_menu=[]
session.create_dropdown=[]
session.retrieve_dropdown=[]

Don't I?

Kind regards,

Annet.

-- 





[web2py] Vars dictionary -- legal to have 'int'?

2012-08-01 Thread AbrahamLinksys
Hi,

I have an appilcation that has been running for a while, and suddenly today 
it gave an error on this line in my view:

  
  [show 
all attachements]

This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and it 
throws an error complaining that it cannot concatenate string and int types 
(because of dict(all=1) instead of all='1')

Of course, the error can be fixed by passing a string literal or calling 
str() on the int, but i was curious if this intended? 

I haven't been very careful to only use string vars, assuming that my 
laziness would be corrected by some gluonic magic. 

Am I supposed to have always been passing only strings as vars? Should I be 
proactive and hunt down places in my code in other applications (which are 
still using slightly older web2py versions) or is this something that might 
change back to being able to use integers? 

Just curious. Here's the relevant part of the traceback:

  File "/usr/web2py-latest/gluon/html.py", line 330, in URL
other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
TypeError: cannot concatenate 'str' and 'int' objects


If the "other+=" line were rewritten as such, would it be a bad thing for any 
reason?

other += '?%s' % '&'.join([*str(*var[0]*)*+'='+str(var[1]) for var in 
list_vars])


Thanks,

Abe

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Luther Goh Lu Feng


On Wednesday, August 1, 2012 10:40:20 PM UTC+8, Anthony wrote:
>
> On Wednesday, August 1, 2012 9:50:07 AM UTC-4, Massimo Di Pierro wrote:
>>
>> So perhaps poweredby apps should have a flag and flagged apps should 
>> always be on top. 
>>
>
> That is already the case, though we don't make a distinction between 
>  "examples" and "derivative projects" for that purpose.
>
> Anthony
>

Please refer to what Drupal has done:

- For sites that have been built with Drupal: http://drupal.org/case-studies
- For distributions of Drupal with site features and functions for a 
specific type of site as a single download containing Drupal core, 
contributed modules, themes, and pre-defined configuration: 
 http://drupal.org/project/distributions 

I think maybe projects like web2conf and Instapress can be considered as a 
web2py distribution, similar to Drupal and Linux.

Best regards,

Luther

-- 





Re: [web2py] Web2py in apache mod_wsgi with virtualenv

2012-08-01 Thread Jonathan Lundell
On 1 Aug 2012, at 8:13 AM, Daniel Gonzalez  wrote:
> I am deploying a web2py application, and I will be serving it with Apache via 
> mod_wsgi. I have the following WSGI directives in my virtual host 
> configuration:
> 
> WSGIDaemonProcess web2py user=www-data group=www-data \
> display-name=%{GROUP}
> WSGIProcessGroup web2py
> WSGIScriptAlias / /var/www/web2py/wsgihandler.py
> 
> 
> This is working, but it is taking the system wide python installation. As a 
> result, some packages are not found (since they are only present in my 
> virtualenv). I would like to tell this particular virtual host (or the whole 
> Apache, if there is no other way), to use the python installation in my 
> virtual environment (/home/myuser/.virtualenvs/python2.7.2/bin).
> 
> Is it possible to configure this for Apache? Or better, just for my virtual 
> host? I would like to cause as little effect as possible to the rest of the 
> system (specifically, I do not want to modify the default python version used 
> system wide)
> 

http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

-- 





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Massimo Di Pierro
Yes. this is wrong:

Field('City', db.city, 'list:reference city', label='Miestas'),

should be

Field('City', 'list:reference city', label='Miestas'),

On Wednesday, 1 August 2012 09:15:07 UTC-5, Aurelijus Useckas wrote:
>
> Thank you Massimo, but the 1005/150 mysql problem seems to be smth wring 
> with foreign key (merging of tables). Are there any flaws in my DAL syntax? 
>
> This line seems to be the trigger:
> Field('City', db.city, 'list:reference city', label='Miestas'),
>
> it references:
>
> db.define_table('city',
> Field('name', notnull=True, unique=True),
> format='%(name)s')
>
> any ideas what's bothering mysql? 
>
>
> On Wednesday, August 1, 2012 4:56:03 PM UTC+3, Massimo Di Pierro wrote:
>>
>> db = DAL('mysql://', check_reserved=['common','mysql'])
>>
>> Anyway, I am not sure your problem is that you are using  a reserved 
>> keyword. Perhaps the table exists already. I am also surprised you are 
>> getting a pymysql InternalError and not an OperationalError.
>>
>> On Wednesday, 1 August 2012 07:45:01 UTC-5, Aurelijus Useckas wrote:
>>>
>>> I've changed the long into longitude and it seems to be solved but I 
>>> still get errors:
>>>
>>> p2
>>> S' (1005, u"Can\'t 
>>> create table \'./lpkdb/asoc.frm\' (errno: 150)")'
>>>
>>> Now it says it cannot create next table, which is:
>>>
>>> db.define_table('asoc',
>>> Field('name', label='Pavadinimas', unique=True),
>>> Field('City', db.city, 'list:reference city', label='Miestas'),
>>> Field('address', label='Adresas'),
>>> Field('www'),
>>> Field('tel'),
>>> Field('fax'),
>>> Field('email'),
>>> Field('President', label='Asociacijos prezidentas'),
>>> Field('CEO', label='Asociacijos generalinis'),
>>> Field('CEO_tel', label='Generalinio tel.'),
>>> Field('CEO_email', label='Generalinio email'),
>>> Field('CEO_mob', label='Generalinio mobilus'),
>>> Field('Pres_tel', label='Prezidento tel.'),
>>> Field('Pres_email', label='Prezidento email'),
>>> Field('Pres_mob', label='Prezidento mobilus'),
>>> Field('submited_at', 'datetime', default=request.now, 
>>> writable=False, readable=False),
>>> Field('updated_at', 'datetime', default=request.now, 
>>> update=request.now, writable=False, readable=False),
>>> Field('submited_by', db.auth_user, default=auth.user_id, 
>>> writable=False, readable=False),
>>> Field('updated_by', db.auth_user, update=auth.user_id, 
>>> writable=False, readable=False),
>>> format='%(name)s')
>>>
>>> Are there some guidlines on how to construct DAL field names in order to 
>>> avoid any conflict while migrating to mysql?
>>>  
>>>
>>> On Wednesday, August 1, 2012 3:36:51 PM UTC+3, tomasz bandura wrote:

 Is it 'long' a mysql's reserved word?

 Regards
 Tomasz

 2012/8/1 Aurelijus Useckas 

> this is the trigger i guess:
>
> db.define_table('maps',
> Field('name'),
> Field('last_name'),
> Field('long'),
> Field('lat'),
> format='%(name)s')
>
> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas wrote:
>>
>> Hi, 
>>
>> I've built the app on SQLite and now want to migrate to the server 
>> based mysql. BUT web2py hangs in the middle of creating, basicaly just 
>> after the auth tables. When I restart the apache I can see auth tables 
>> as 
>> well as a few from my app.
>>
>> this is the err ticket that I get:
>>
>> (dp1
>> S'output'
>> p2
>> S' (1064, 
>> u"You have an error in your SQL syntax; check the manual that 
>> corresponds 
>> to your MySQL server version for the right syntax to use near \'long 
>> VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
>> ENGINE=InnoDB CHA\' at line 5")'
>> p3
>> sS'layer'
>> p4
>> S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
>> p5
>> sS'code'
>> p6
>>
>> thnx
>>
>  -- 
>  
>  
>  
>



-- 





[web2py] Re: session.cmsadmin_menu=session.create_dropdown=session.retrieve_dropdown=[] unexpected behaviour

2012-08-01 Thread Anthony
I think the main issue is with the lists, which are mutable -- if all the 
variables refer to the same list and you mutate the list, all the variables 
will still refer to that changed list. If you want to be able to change one 
of the lists without affecting the others, then you need the separate 
assignments, as below.

Anthony

On Wednesday, August 1, 2012 11:22:51 AM UTC-4, Annet wrote:
>
> Hi Anthony,
>
> This might help: 
>> http://inst.eecs.berkeley.edu/~selfpace/cs9honline/Q2/mutation.html.
>
>
> That was helpful.
>
> As you know I am working on a network application, which is node i.e 
> nodeID driven. When nodeID's change I need a way to reset all variable's 
> stored in session, to use them in conditionals to test if they are False or 
> in order to assign new values to them.
>
> session.userNodeID gets assigned an id, session.userNodeName a string and 
> session.userNodeMembership a list, just like the menu and dropdown 
> variables. So I'd better do the following:
>
> session.userNodeID=0
> session.userNodeName=''
> session.userNodeMembership=[]
> session.cmsadmin_menu=[]
> session.create_dropdown=[]
> session.retrieve_dropdown=[]
>
> Don't I?
>
> Kind regards,
>
> Annet.
>

-- 





[web2py] Re: format attribute in Record Representation

2012-08-01 Thread lyn2py
Do you mean like:

requires=IS_IN_DB(db,'sometable.id','%(name)s (%(description)s)')

If so, yes I have them there. The purpose is to create the drop down 
menu... unless I'm doing it wrong? Or is there another way about it so that 
the references will appear per the manual?

Thanks Anthony!

On Wednesday, August 1, 2012 11:21:40 PM UTC+8, Anthony wrote:
>
> Have you explicitly set any validators for the field (e.g., IS_IN_DB)? I 
> believe you only get the default represent attribute when you don't 
> explicitly set a validator (perhaps that should be changed).
>
> Anthony
>
> On Wednesday, August 1, 2012 11:17:24 AM UTC-4, lyn2py wrote:
>>
>> I refer to http://web2py.com/books/default/chapter/29/6 under Record 
>> representation
>>
>>> The format attribute will be used for two purposes:
>>>
>>>- To represent referenced records in select/option drop-downs.
>>>
>>>
>>>- To set the db.othertable.person.represent attribute for all fields 
>>>referencing this table. This means that SQLTABLE will not show 
>>> references 
>>>by id but will use the format preferred representation instead.
>>>
>>>
>>
>>1. I have specified the format but it doesn't appear per the format 
>>(in appadmin, when listing table records). I have restarted the server 
>>(just in case) but it still references the ID rather than the specified 
>>format. Any ideas?
>>2. It also doesn't appear so in the drop down menus (again, all 
>>appear as IDs). I had to separately specify the format for the drop down 
>>menus. Is it supposed to work this way? It doesn't seem like it based on 
>>the above explanation.
>>
>> Please help. Thanks!
>>
>>

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Massimo Di Pierro
We could make that distinction (additional flag) and have two tabs.

On Wednesday, 1 August 2012 09:40:20 UTC-5, Anthony wrote:
>
> On Wednesday, August 1, 2012 9:50:07 AM UTC-4, Massimo Di Pierro wrote:
>>
>> So perhaps poweredby apps should have a flag and flagged apps should 
>> always be on top. 
>>
>
> That is already the case, though we don't make a distinction between 
>  "examples" and "derivative projects" for that purpose.
>
> Anthony
>

-- 





[web2py] Re: existing tables in plugin_wiki

2012-08-01 Thread Massimo Di Pierro
This is a bug in plugin_wiki but the bug is triggered by

record_id: id

id should be a number.

On Wednesday, 1 August 2012 10:07:17 UTC-5, Larry Wapnitsky wrote:
>
> I'm attempting to access database tables created in my db.py file using 
> different aspects of plugin_wiki.  Whenever I enter the table name, I get 
> the following as my results on my "page":
>
> Traceback (most recent call last):
>   File 
> "/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", 
> line 631, in render_widget
> args = dict((item[0].strip(), self.parse_value(item[1].strip())) for item 
> in items)
>   File 
> "/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", 
> line 631, in 
> args = dict((item[0].strip(), self.parse_value(item[1].strip())) for item 
> in items)
> IndexError: list index out of range
>
>
> Here is the code on the wiki page that was generated by the builder:
> ``
> name: read
> table: message
> record_id: id
> ``:widget
>
> Thanks
>

-- 





Re: [web2py] Re: existing tables in plugin_wiki

2012-08-01 Thread Larry G. Wapnitsky

got it.  thanks.
On 8/1/2012 11:38 AM, Massimo Di Pierro wrote:

This is a bug in plugin_wiki but the bug is triggered by

record_id: id

id should be a number.

On Wednesday, 1 August 2012 10:07:17 UTC-5, Larry Wapnitsky wrote:

I'm attempting to access database tables created in my db.py file
using different aspects of plugin_wiki.  Whenever I enter the
table name, I get the following as my results on my "page":

Traceback (most recent call last):
   File 
"/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", line 
631, in render_widget
 args = dict((item[0].strip(), self.parse_value(item[1].strip())) for 
item in items)
   File 
"/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", line 
631, in
 args = dict((item[0].strip(), self.parse_value(item[1].strip())) for 
item in items)
IndexError: list index out of range


Here is the code on the wiki page that was generated by the builder:
|
``
name:read
table:message
record_id:id
``:widget
|

Thanks

--





--





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Anthony

>
> Please refer to what Drupal has done:
>
> - For sites that have been built with Drupal: 
> http://drupal.org/case-studies
>

http://web2py.com/poweredby is intended to serve this purpose.
 

> - For distributions of Drupal with site features and functions for a 
> specific type of site as a single download containing Drupal core, 
> contributed modules, themes, and pre-defined configuration:  
> http://drupal.org/project/distributions 
>

I think this kind of thing belongs in http://www.web2py.com/appliances. We 
should probably add Movuca, Instant Press, etc. to appliances.

Note, some of these "distributions" also appear on the PoweredBy list, but 
only if they have a working demo (i.e., the PoweredBy list only includes 
links to actual running websites, whether production or demo -- not simply 
to source code repos or downloads, as appliances does).

Anthony

-- 





[web2py] Re: Vars dictionary -- legal to have 'int'?

2012-08-01 Thread Massimo Di Pierro
in trunk. please check it.

On Wednesday, 1 August 2012 10:23:11 UTC-5, AbrahamLinksys wrote:
>
> Hi,
>
> I have an appilcation that has been running for a while, and suddenly 
> today it gave an error on this line in my view:
>
>   
>   [show 
> all attachements]
>
> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and 
> it throws an error complaining that it cannot concatenate string and int 
> types (because of dict(all=1) instead of all='1')
>
> Of course, the error can be fixed by passing a string literal or calling 
> str() on the int, but i was curious if this intended? 
>
> I haven't been very careful to only use string vars, assuming that my 
> laziness would be corrected by some gluonic magic. 
>
> Am I supposed to have always been passing only strings as vars? Should I 
> be proactive and hunt down places in my code in other applications (which 
> are still using slightly older web2py versions) or is this something that 
> might change back to being able to use integers? 
>
> Just curious. Here's the relevant part of the traceback:
>
>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
> TypeError: cannot concatenate 'str' and 'int' objects
>
>
> If the "other+=" line were rewritten as such, would it be a bad thing for any 
> reason?
>
> other += '?%s' % '&'.join([*str(*var[0]*)*+'='+str(var[1]) for var in 
> list_vars])
>
>
> Thanks,
>
> Abe
>
>

-- 





[web2py] Giving a talk promoting web2py over Django

2012-08-01 Thread Alec Taylor
Tonight I'm going to present my little social-network to a user-group.

I'm going to show them my code, some slides, the website, the mobile apps
and tell them when Django isn't as good as web2py.

Are there any particular features of web2py you would recommend I
highlight? - Also, are there any major drawbacks in Django that web2py has
that is easily advertisable?

(I have a slide or two on this, but I'm sure as longtime users/developers
of web2py you'd have more to pitch-in)

Thanks for all information,

Alec Taylor

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Michele Comitini
Would be nice that each "appliance" should have at least a github or
whatever to have a live project and not a dead one that no one is going to
pickup or contribute to.

mic


2012/8/1 Anthony 

> Please refer to what Drupal has done:
>>
>> - For sites that have been built with Drupal:
>> http://drupal.org/case-studies
>>
>
> http://web2py.com/poweredby is intended to serve this purpose.
>
>
>> - For distributions of Drupal with site features and functions for a
>> specific type of site as a single download containing Drupal core,
>> contributed modules, themes, and pre-defined configuration:
>> http://drupal.**org/project/distributions
>>
>>
>
> I think this kind of thing belongs in http://www.web2py.com/appliances.
> We should probably add Movuca, Instant Press, etc. to appliances.
>
> Note, some of these "distributions" also appear on the PoweredBy list, but
> only if they have a working demo (i.e., the PoweredBy list only includes
> links to actual running websites, whether production or demo -- not simply
> to source code repos or downloads, as appliances does).
>
> Anthony
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Luther Goh Lu Feng

I think the drupal site really presents their case studies and 
distributions very well, each with tagging and blog posts. Web2py probably 
can learn from it... Probably post this on a separate thread 


On Wednesday, August 1, 2012 11:40:15 PM UTC+8, Anthony wrote:
>
> Please refer to what Drupal has done:
>>
>> - For sites that have been built with Drupal: 
>> http://drupal.org/case-studies
>>
>
> http://web2py.com/poweredby is intended to serve this purpose.
>  
>
>> - For distributions of Drupal with site features and functions for a 
>> specific type of site as a single download containing Drupal core, 
>> contributed modules, themes, and pre-defined configuration:  
>> http://drupal.org/project/distributions 
>>
>
> I think this kind of thing belongs in http://www.web2py.com/appliances. 
> We should probably add Movuca, Instant Press, etc. to appliances.
>
> Note, some of these "distributions" also appear on the PoweredBy list, but 
> only if they have a working demo (i.e., the PoweredBy list only includes 
> links to actual running websites, whether production or demo -- not simply 
> to source code repos or downloads, as appliances does).
>
> Anthony
>
>

-- 





Re: [web2py] Vars dictionary -- legal to have 'int'?

2012-08-01 Thread Jonathan Lundell
On 1 Aug 2012, at 8:23 AM, AbrahamLinksys  wrote:
> I have an appilcation that has been running for a while, and suddenly today 
> it gave an error on this line in my view:
> 
>  
>   [show all 
> attachements]
> 
> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and it 
> throws an error complaining that it cannot concatenate string and int types 
> (because of dict(all=1) instead of all='1')

That's odd, because by default line 330 should not be being executed (because 
url_encode defaults to true). Can you please double-check your 
environment/version/etc? The fact that it's exactly line 330 argues that it's 
1.99.7, but how do we get there? I just added a handful of unit tests to verify 
the expected behavior (temporarily in a scratch copy of 1.99.7; sorry, no 
patch), and it checks out OK.

(BTW, that should be "show all attachments".)

While it wouldn't hurt to force str(), the idea here is that the only reason 
you'd be executing that line is that your vars are *already* url-encoded, which 
would mean they're already strings.

> 
> Of course, the error can be fixed by passing a string literal or calling 
> str() on the int, but i was curious if this intended? 
> 
> I haven't been very careful to only use string vars, assuming that my 
> laziness would be corrected by some gluonic magic. 
> 
> Am I supposed to have always been passing only strings as vars? Should I be 
> proactive and hunt down places in my code in other applications (which are 
> still using slightly older web2py versions) or is this something that might 
> change back to being able to use integers? 
> 
> Just curious. Here's the relevant part of the traceback:
> 
>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
> TypeError: cannot concatenate 'str' and 'int' objects
> 
> If the "other+=" line were rewritten as such, would it be a bad thing for any 
> reason?
> other += '?%s' % '&'.join([str(var[0])+'='+str(var[1]) for var in 
> list_vars])
> 
> Thanks,
> Abe
> 
> 


-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Anthony
On Wednesday, August 1, 2012 11:37:03 AM UTC-4, Massimo Di Pierro wrote:
>
> We could make that distinction (additional flag) and have two tabs.
>

We could, though see my other reply. Not all derivatives/distributions have 
a running demo site, so it's probably best to include those kinds of 
projects in http://www.web2py.com/appliances. It might make more sense to 
enhance the appliances site -- (a) let users add projects, (b) enable 
linking to other repos (besides the github web2py-appliances master repo), 
(c) enable tagging, (d) enable linking to running demo sites or project 
sites (in addition to the source code repo), (e) allow flagging of featured 
sites to be displayed more prominently. Ultimately, it might make sense to 
have a single site for both appliances and plugins working in this way. 
Note, I believe web2pyslices 2.0 was originally intended to include this 
functionality (i.e., in addition to posting recipes, questions, and 
articles, it was supposed to allow posting of plugins and applications).

Anthony

-- 





Re: [web2py] Web2py in apache mod_wsgi with virtualenv

2012-08-01 Thread Daniel Gonzalez
Quoting from the link you posted:

"The purpose of such Python virtual environments is to allow one to create 
multiple distinct Python environments for the same version of Python, but 
with different sets of Python modules and packages installed into the 
Python 'site-packages' directory."

This does not meet my requirements: I have different python versions. 
Actually, I have the system-wide python (2.6.5), which I *do not* want to 
use for mod_wsgi, and the python in my virtualenv (which I have 
bootrstrapped, version 2.7.2), which is the one that I want to use.

So, my virtualenv has both, packages and python binary. The reason is that 
my python (web2py) application needs a specific version of python, which is 
not available system wide.

So, how can I tell mod_wsgi to use the python binary in my virtualenv? 
Usually, just by setting the PATH to point to it (preceeding the path of 
the system wide python), all scripts starting with "#!/usr/bin/env python" 
would use the right python version, but this does not seem to work in case 
of mod_wsgi.

Any ideas?

Thanks,
Daniel

On Wednesday, August 1, 2012 5:30:07 PM UTC+2, Jonathan Lundell wrote:
>
> On 1 Aug 2012, at 8:13 AM, Daniel Gonzalez  wrote:
>
> I am deploying a web2py application, and I will be serving it with Apache 
> via mod_wsgi. I have the following WSGI directives in my virtual host 
> configuration:
>
> WSGIDaemonProcess web2py user=www-data group=www-data \
> display-name=%{GROUP}
> WSGIProcessGroup web2py
> WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>
>
> This is working, but it is taking the system wide python installation. As 
> a result, some packages are not found (since they are only present in my 
> virtualenv). I would like to tell this particular virtual host (or the 
> whole Apache, if there is no other way), to use the python installation in 
> my virtual environment (/home/myuser/.virtualenvs/python2.7.2/bin).
>
> Is it possible to configure this for Apache? Or better, just for my 
> virtual host? I would like to cause as little effect as possible to the 
> rest of the system (specifically, I do not want to modify the default 
> python version used system wide)
>
>
> http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
>

-- 





Re: [web2py] Re: Vars dictionary -- legal to have 'int'?

2012-08-01 Thread Jonathan Lundell
On 1 Aug 2012, at 8:42 AM, Massimo Di Pierro  wrote:
> in trunk. please check it.

Per my earlier message, this should not be necessary. There must be something 
else wrong, and str() unfortunately just papers over whatever the real problem 
is.

> 
> On Wednesday, 1 August 2012 10:23:11 UTC-5, AbrahamLinksys wrote:
> Hi,
> 
> I have an appilcation that has been running for a while, and suddenly today 
> it gave an error on this line in my view:
> 
>  
>   [show all 
> attachements]
> 
> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and it 
> throws an error complaining that it cannot concatenate string and int types 
> (because of dict(all=1) instead of all='1')
> 
> Of course, the error can be fixed by passing a string literal or calling 
> str() on the int, but i was curious if this intended? 
> 
> I haven't been very careful to only use string vars, assuming that my 
> laziness would be corrected by some gluonic magic. 
> 
> Am I supposed to have always been passing only strings as vars? Should I be 
> proactive and hunt down places in my code in other applications (which are 
> still using slightly older web2py versions) or is this something that might 
> change back to being able to use integers? 
> 
> Just curious. Here's the relevant part of the traceback:
> 
>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
> TypeError: cannot concatenate 'str' and 'int' objects
> 
> If the "other+=" line were rewritten as such, would it be a bad thing for any 
> reason?
> other += '?%s' % '&'.join([str(var[0])+'='+str(var[1]) for var in 
> list_vars])
> 
> Thanks,
> Abe
> 
> -- 
>  


-- 





Re: [web2py] Web2py in apache mod_wsgi with virtualenv

2012-08-01 Thread Jonathan Lundell
On 1 Aug 2012, at 8:52 AM, Daniel Gonzalez  wrote:
> Quoting from the link you posted:
> 
> "The purpose of such Python virtual environments is to allow one to create 
> multiple distinct Python environments for the same version of Python, but 
> with different sets of Python modules and packages installed into the Python 
> 'site-packages' directory."

It (virtualenv) also supports different Python versions. Note later in the text 
where they talk about making sure that your mod_wsgi is built with the Python 
version you're using in the virtualenv.

> 
> This does not meet my requirements: I have different python versions. 
> Actually, I have the system-wide python (2.6.5), which I *do not* want to use 
> for mod_wsgi, and the python in my virtualenv (which I have bootrstrapped, 
> version 2.7.2), which is the one that I want to use.
> 
> So, my virtualenv has both, packages and python binary. The reason is that my 
> python (web2py) application needs a specific version of python, which is not 
> available system wide.
> 
> So, how can I tell mod_wsgi to use the python binary in my virtualenv? 
> Usually, just by setting the PATH to point to it (preceeding the path of the 
> system wide python), all scripts starting with "#!/usr/bin/env python" would 
> use the right python version, but this does not seem to work in case of 
> mod_wsgi.
> 
> Any ideas?
> 
> Thanks,
> Daniel
> 
> On Wednesday, August 1, 2012 5:30:07 PM UTC+2, Jonathan Lundell wrote:
> On 1 Aug 2012, at 8:13 AM, Daniel Gonzalez  wrote:
>> I am deploying a web2py application, and I will be serving it with Apache 
>> via mod_wsgi. I have the following WSGI directives in my virtual host 
>> configuration:
>> 
>> WSGIDaemonProcess web2py user=www-data group=www-data \
>> display-name=%{GROUP}
>> WSGIProcessGroup web2py
>> WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>> 
>> 
>> This is working, but it is taking the system wide python installation. As a 
>> result, some packages are not found (since they are only present in my 
>> virtualenv). I would like to tell this particular virtual host (or the whole 
>> Apache, if there is no other way), to use the python installation in my 
>> virtual environment (/home/myuser/.virtualenvs/python2.7.2/bin).
>> 
>> Is it possible to configure this for Apache? Or better, just for my virtual 
>> host? I would like to cause as little effect as possible to the rest of the 
>> system (specifically, I do not want to modify the default python version 
>> used system wide)
>> 
> 
> http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
> 
> 


-- 





Re: [web2py] Giving a talk promoting web2py over Django

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

We2bpy strengths over Django:

1) Automatic migrations. It enforces baby steps design just 
out-of-the-box. South migrations is a powerful tool, but Django doesn't 
have it natively yet.
2) Web2py shows a generic template when you don't have one created. Yet, 
baby steps guaranteed.


I see these 2 as good features to Web2py newbies.


--
Vinicius Assef



On 08/01/2012 12:46 PM, Alec Taylor wrote:

Tonight I'm going to present my little social-network to a user-group.

I'm going to show them my code, some slides, the website, the mobile
apps and tell them when Django isn't as good as web2py.

Are there any particular features of web2py you would recommend I
highlight? - Also, are there any major drawbacks in Django that web2py
has that is easily advertisable?

(I have a slide or two on this, but I'm sure as longtime
users/developers of web2py you'd have more to pitch-in)

Thanks for all information,

Alec Taylor

--





--





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Aurelijus Useckas
tried it, still the same error :( thnx anyway

On Wednesday, August 1, 2012 6:31:52 PM UTC+3, Massimo Di Pierro wrote:
>
> Yes. this is wrong:
>
> Field('City', db.city, 'list:reference city', label='Miestas'),
>
> should be
>
> Field('City', 'list:reference city', label='Miestas'),
>
> On Wednesday, 1 August 2012 09:15:07 UTC-5, Aurelijus Useckas wrote:
>>
>> Thank you Massimo, but the 1005/150 mysql problem seems to be smth wring 
>> with foreign key (merging of tables). Are there any flaws in my DAL syntax? 
>>
>> This line seems to be the trigger:
>> Field('City', db.city, 'list:reference city', label='Miestas'),
>>
>> it references:
>>
>> db.define_table('city',
>> Field('name', notnull=True, unique=True),
>> format='%(name)s')
>>
>> any ideas what's bothering mysql? 
>>
>>
>> On Wednesday, August 1, 2012 4:56:03 PM UTC+3, Massimo Di Pierro wrote:
>>>
>>> db = DAL('mysql://', check_reserved=['common','mysql'])
>>>
>>> Anyway, I am not sure your problem is that you are using  a reserved 
>>> keyword. Perhaps the table exists already. I am also surprised you are 
>>> getting a pymysql InternalError and not an OperationalError.
>>>
>>> On Wednesday, 1 August 2012 07:45:01 UTC-5, Aurelijus Useckas wrote:

 I've changed the long into longitude and it seems to be solved but I 
 still get errors:

 p2
 S' (1005, u"Can\'t 
 create table \'./lpkdb/asoc.frm\' (errno: 150)")'

 Now it says it cannot create next table, which is:

 db.define_table('asoc',
 Field('name', label='Pavadinimas', unique=True),
 Field('City', db.city, 'list:reference city', label='Miestas'),
 Field('address', label='Adresas'),
 Field('www'),
 Field('tel'),
 Field('fax'),
 Field('email'),
 Field('President', label='Asociacijos prezidentas'),
 Field('CEO', label='Asociacijos generalinis'),
 Field('CEO_tel', label='Generalinio tel.'),
 Field('CEO_email', label='Generalinio email'),
 Field('CEO_mob', label='Generalinio mobilus'),
 Field('Pres_tel', label='Prezidento tel.'),
 Field('Pres_email', label='Prezidento email'),
 Field('Pres_mob', label='Prezidento mobilus'),
 Field('submited_at', 'datetime', default=request.now, 
 writable=False, readable=False),
 Field('updated_at', 'datetime', default=request.now, 
 update=request.now, writable=False, readable=False),
 Field('submited_by', db.auth_user, default=auth.user_id, 
 writable=False, readable=False),
 Field('updated_by', db.auth_user, update=auth.user_id, 
 writable=False, readable=False),
 format='%(name)s')

 Are there some guidlines on how to construct DAL field names in order 
 to avoid any conflict while migrating to mysql?
  

 On Wednesday, August 1, 2012 3:36:51 PM UTC+3, tomasz bandura wrote:
>
> Is it 'long' a mysql's reserved word?
>
> Regards
> Tomasz
>
> 2012/8/1 Aurelijus Useckas 
>
>> this is the trigger i guess:
>>
>> db.define_table('maps',
>> Field('name'),
>> Field('last_name'),
>> Field('long'),
>> Field('lat'),
>> format='%(name)s')
>>
>> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas 
>> wrote:
>>>
>>> Hi, 
>>>
>>> I've built the app on SQLite and now want to migrate to the server 
>>> based mysql. BUT web2py hangs in the middle of creating, basicaly just 
>>> after the auth tables. When I restart the apache I can see auth tables 
>>> as 
>>> well as a few from my app.
>>>
>>> this is the err ticket that I get:
>>>
>>> (dp1
>>> S'output'
>>> p2
>>> S' (1064, 
>>> u"You have an error in your SQL syntax; check the manual that 
>>> corresponds 
>>> to your MySQL server version for the right syntax to use near \'long 
>>> VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
>>> ENGINE=InnoDB CHA\' at line 5")'
>>> p3
>>> sS'layer'
>>> p4
>>> S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
>>> p5
>>> sS'code'
>>> p6
>>>
>>> thnx
>>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Can I ignore ssl with apache for windows?

2012-08-01 Thread joe
Hello

This is my first time doing this, and* *I am not at all sure about what I 
am doing.  I am using a dedicated windows server, the my application is 
going to be running on my company's secure intranet.  When I have to work 
with the database's code, I'll be doing so by remotely connecting to the 
server, and therefore I don't need to admin application.

I also don't need to worry about load/scaling (20 people max will be 
accessing this).

Can I set up apache in a way that doesn't require me messing with ssl? Or 
can I configure rocket to work as a service on our intranet, and leave it 
at that?

Thanks!

-- 





Re: [web2py] Re: existing tables in plugin_wiki

2012-08-01 Thread Larry G. Wapnitsky
what about search?  i specify one field to show, and it shows me all 
search fields?



On 8/1/2012 11:38 AM, Larry G. Wapnitsky wrote:

got it.  thanks.
On 8/1/2012 11:38 AM, Massimo Di Pierro wrote:

This is a bug in plugin_wiki but the bug is triggered by

record_id: id

id should be a number.

On Wednesday, 1 August 2012 10:07:17 UTC-5, Larry Wapnitsky wrote:

I'm attempting to access database tables created in my db.py file
using different aspects of plugin_wiki.  Whenever I enter the
table name, I get the following as my results on my "page":

Traceback (most recent call last):
   File 
"/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", line 
631, in render_widget
 args = dict((item[0].strip(), self.parse_value(item[1].strip())) for 
item in items)
   File 
"/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", line 
631, in
 args = dict((item[0].strip(), self.parse_value(item[1].strip())) for 
item in items)
IndexError: list index out of range


Here is the code on the wiki page that was generated by the builder:
|
``
name:read
table:message
record_id:id
``:widget
|

Thanks

--







--





Re: [web2py] Giving a talk promoting web2py over Django

2012-08-01 Thread Michele Comitini
Less boilerplate code.
Sane defaults.

mic


2012/8/1 vinicius...@gmail.com 

> We2bpy strengths over Django:
>
> 1) Automatic migrations. It enforces baby steps design just
> out-of-the-box. South migrations is a powerful tool, but Django doesn't
> have it natively yet.
> 2) Web2py shows a generic template when you don't have one created. Yet,
> baby steps guaranteed.
>
> I see these 2 as good features to Web2py newbies.
>
>
> --
> Vinicius Assef
>
>
>
>
> On 08/01/2012 12:46 PM, Alec Taylor wrote:
>
>> Tonight I'm going to present my little social-network to a user-group.
>>
>> I'm going to show them my code, some slides, the website, the mobile
>> apps and tell them when Django isn't as good as web2py.
>>
>> Are there any particular features of web2py you would recommend I
>> highlight? - Also, are there any major drawbacks in Django that web2py
>> has that is easily advertisable?
>>
>> (I have a slide or two on this, but I'm sure as longtime
>> users/developers of web2py you'd have more to pitch-in)
>>
>> Thanks for all information,
>>
>> Alec Taylor
>>
>> --
>>
>>
>>
>>
> --
>
>
>
>

-- 





Re: [web2py] Giving a talk promoting web2py over Django

2012-08-01 Thread Bruno Rocha
web2py has a more flexible template engine, you can use Python there and
does not need to create a tons of template filters to get simple things
done. Also in Django the template language sucks a lot because of the
limitations.

Let me give an example:

To build a map using google maps API you have to inform the lat/long, for
some reason in my database the information was stored as "-23,4500" google
maps does not accept it with the comma, so it is easy with Python and
web2py.


map = new GMap({"lat":* {{=myplace.lat.replace(",", ".")}}*, .)


As you can see web2py allowed me to use pure Python code for this.. lets
try this in Django...

1. Put the template tags configuration in your settings.py
2. Create a directory called templatetags there
3. Create a module for your template tag
4. import, register, decorate and create your template tag

from django import template

register = template.Library()

@register.filter
def replace(value, args):
value = str(value)
args = str(args)
try:
search, replace = args.split("|")
except Exception:
return value
else:
return value.replace(search, replace)

Template tags/filters are limited functions which receives only one
argument, so you have to receive this as string to be able to split them un
multiple args.

5. Now in your template file you can use the simple "replace" feature in a
weird way


map = new GMap({"lat":* {{ myplace.lat | replace: ",|." }}*, .)


web2py templates are also very good for some other reasons:

- it allows to create HTML functions
- It has a nice block system
- It allows us to use PURE PYTHON to solve simple things!



On Wed, Aug 1, 2012 at 12:57 PM, vinicius...@gmail.com <
vinicius...@gmail.com> wrote:

> We2bpy strengths over Django:
>
> 1) Automatic migrations. It enforces baby steps design just
> out-of-the-box. South migrations is a powerful tool, but Django doesn't
> have it natively yet.
> 2) Web2py shows a generic template when you don't have one created. Yet,
> baby steps guaranteed.
>
> I see these 2 as good features to Web2py newbies.
>
>
> --
> Vinicius Assef
>
>
>
>
> On 08/01/2012 12:46 PM, Alec Taylor wrote:
>
>> Tonight I'm going to present my little social-network to a user-group.
>>
>> I'm going to show them my code, some slides, the website, the mobile
>> apps and tell them when Django isn't as good as web2py.
>>
>> Are there any particular features of web2py you would recommend I
>> highlight? - Also, are there any major drawbacks in Django that web2py
>> has that is easily advertisable?
>>
>> (I have a slide or two on this, but I'm sure as longtime
>> users/developers of web2py you'd have more to pitch-in)
>>
>> Thanks for all information,
>>
>> Alec Taylor
>>
>> --
>>
>>
>>
>>
> --
>
>
>
>

-- 





Re: [web2py] Giving a talk promoting web2py over Django

2012-08-01 Thread Michele Comitini
http://www.web2py.com/examples/static/web2py_vs_others.pdf


2012/8/1 Michele Comitini 

> Less boilerplate code.
> Sane defaults.
>
> mic
>
>
> 2012/8/1 vinicius...@gmail.com 
>
> We2bpy strengths over Django:
>>
>> 1) Automatic migrations. It enforces baby steps design just
>> out-of-the-box. South migrations is a powerful tool, but Django doesn't
>> have it natively yet.
>> 2) Web2py shows a generic template when you don't have one created. Yet,
>> baby steps guaranteed.
>>
>> I see these 2 as good features to Web2py newbies.
>>
>>
>> --
>> Vinicius Assef
>>
>>
>>
>>
>> On 08/01/2012 12:46 PM, Alec Taylor wrote:
>>
>>> Tonight I'm going to present my little social-network to a user-group.
>>>
>>> I'm going to show them my code, some slides, the website, the mobile
>>> apps and tell them when Django isn't as good as web2py.
>>>
>>> Are there any particular features of web2py you would recommend I
>>> highlight? - Also, are there any major drawbacks in Django that web2py
>>> has that is easily advertisable?
>>>
>>> (I have a slide or two on this, but I'm sure as longtime
>>> users/developers of web2py you'd have more to pitch-in)
>>>
>>> Thanks for all information,
>>>
>>> Alec Taylor
>>>
>>> --
>>>
>>>
>>>
>>>
>> --
>>
>>
>>
>>
>

-- 





[web2py] Re: format attribute in Record Representation

2012-08-01 Thread Anthony

>
> Do you mean like:
>
> requires=IS_IN_DB(db,'sometable.id','%(name)s (%(description)s)')
>
> If so, yes I have them there. The purpose is to create the drop down 
> menu... unless I'm doing it wrong? Or is there another way about it so that 
> the references will appear per the manual?
>

Yes, that's what I mean. By specifying the validator, you no longer get the 
default "represent" attribute. Is '%(name)s (%(description)s)' the same as 
the "format" attribute of the db.sometable table? If so, there's no reason 
to explicitly specify that validator, as you will get exactly that 
validator by default anyway (in which case, you will also get the default 
"represent" attribute).

Alternatively, you can do:

Field('sometable', db.sometable, requires=IS_IN_DB(...),
represent=lambda id, row: db.sometable._format % db.sometable(id))

Anthony

-- 





[web2py] Re: Giving a talk promoting web2py over Django

2012-08-01 Thread Anthony
http://www.quora.com/What-are-the-advantages-of-web2py-over-Django

On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:
>
> Tonight I'm going to present my little social-network to a user-group.
>
> I'm going to show them my code, some slides, the website, the mobile apps 
> and tell them when Django isn't as good as web2py.
>
> Are there any particular features of web2py you would recommend I 
> highlight? - Also, are there any major drawbacks in Django that web2py has 
> that is easily advertisable?
>
> (I have a slide or two on this, but I'm sure as longtime users/developers 
> of web2py you'd have more to pitch-in)
>
> Thanks for all information,
>
> Alec Taylor
>

-- 





Re: [web2py] Web2py in apache mod_wsgi with virtualenv

2012-08-01 Thread Daniel Gonzalez
Thanks Jonathan,

On Wednesday, August 1, 2012 5:56:37 PM UTC+2, Jonathan Lundell wrote:
>
> On 1 Aug 2012, at 8:52 AM, Daniel Gonzalez  wrote:
>
> Quoting from the link you posted:
>
> "The purpose of such Python virtual environments is to allow one to create 
> multiple distinct Python environments for the same version of Python, but 
> with different sets of Python modules and packages installed into the 
> Python 'site-packages' directory."
>
>
> It (virtualenv) also supports different Python versions. Note later in the 
> text where they talk about making sure that your mod_wsgi is built with the 
> Python version you're using in the virtualenv.
>

I am not building mod_wsgi: I am installing it with apt-get install. I do 
not know which is the version it was compiled for, since it comes 
pre-packaged with the apache ubuntu distribution. I assume it is the 
system-wide python version (2.6.5).

But I need to use the python version in my virtualenv for my web2py 
application (2.7.2). Running *any* python script with *any* python 
interpreter is usually as easy as making sure that the right python 
interpreter is selected, by setting the PATH, and putting "#!/usr/bin/env 
python" on top of the python script. Why is mod_python different in this 
regard? Isn't it basically a wrapper to call the python interpreter?

Do you think there is any chance at all of using the python version in my 
virtualenv without having to recompile mod_wsgi?

I am afraid that if I start recompiling mod_wsgi this will prove very 
complicated, and it will even force me to recompile apache ...
Besides, what happens if tomorrow I need to upgrade my python version? Then 
I need to recompile mod_wsgi too. Looks complicated :(

Thanks,
Daniel


>
> This does not meet my requirements: I have different python versions. 
> Actually, I have the system-wide python (2.6.5), which I *do not* want to 
> use for mod_wsgi, and the python in my virtualenv (which I have 
> bootrstrapped, version 2.7.2), which is the one that I want to use.
>
> So, my virtualenv has both, packages and python binary. The reason is that 
> my python (web2py) application needs a specific version of python, which is 
> not available system wide.
>
> So, how can I tell mod_wsgi to use the python binary in my virtualenv? 
> Usually, just by setting the PATH to point to it (preceeding the path of 
> the system wide python), all scripts starting with "#!/usr/bin/env python" 
> would use the right python version, but this does not seem to work in case 
> of mod_wsgi.
>
> Any ideas?
>
> Thanks,
> Daniel
>
> On Wednesday, August 1, 2012 5:30:07 PM UTC+2, Jonathan Lundell wrote:
>>
>> On 1 Aug 2012, at 8:13 AM, Daniel Gonzalez  wrote:
>>
>> I am deploying a web2py application, and I will be serving it with Apache 
>> via mod_wsgi. I have the following WSGI directives in my virtual host 
>> configuration:
>>
>> WSGIDaemonProcess web2py user=www-data group=www-data \
>> display-name=%{GROUP}
>> WSGIProcessGroup web2py
>> WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>>
>>
>> This is working, but it is taking the system wide python installation. As 
>> a result, some packages are not found (since they are only present in my 
>> virtualenv). I would like to tell this particular virtual host (or the 
>> whole Apache, if there is no other way), to use the python installation in 
>> my virtual environment (/home/myuser/.virtualenvs/python2.7.2/bin).
>>
>> Is it possible to configure this for Apache? Or better, just for my 
>> virtual host? I would like to cause as little effect as possible to the 
>> rest of the system (specifically, I do not want to modify the default 
>> python version used system wide)
>>
>>
>> http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
>>
>
>
>
>
>

-- 





Re: [web2py] Web2py in apache mod_wsgi with virtualenv

2012-08-01 Thread Jonathan Lundell
On 1 Aug 2012, at 9:30 AM, Daniel Gonzalez  wrote:
> On Wednesday, August 1, 2012 5:56:37 PM UTC+2, Jonathan Lundell wrote:
> On 1 Aug 2012, at 8:52 AM, Daniel Gonzalez  wrote:
>> Quoting from the link you posted:
>> 
>> "The purpose of such Python virtual environments is to allow one to create 
>> multiple distinct Python environments for the same version of Python, but 
>> with different sets of Python modules and packages installed into the Python 
>> 'site-packages' directory."
> 
> It (virtualenv) also supports different Python versions. Note later in the 
> text where they talk about making sure that your mod_wsgi is built with the 
> Python version you're using in the virtualenv.
> 
> I am not building mod_wsgi: I am installing it with apt-get install. I do not 
> know which is the version it was compiled for, since it comes pre-packaged 
> with the apache ubuntu distribution. I assume it is the system-wide python 
> version (2.6.5).
> 
> But I need to use the python version in my virtualenv for my web2py 
> application (2.7.2). Running *any* python script with *any* python 
> interpreter is usually as easy as making sure that the right python 
> interpreter is selected, by setting the PATH, and putting "#!/usr/bin/env 
> python" on top of the python script. Why is mod_python different in this 
> regard? Isn't it basically a wrapper to call the python interpreter?

I'm guessing because it's got some C components, and needs to be compiled 
against the same headers and libraries as the Python binary.

> Do you think there is any chance at all of using the python version in my 
> virtualenv without having to recompile mod_wsgi?
> 
> I am afraid that if I start recompiling mod_wsgi this will prove very 
> complicated, and it will even force me to recompile apache ...
> Besides, what happens if tomorrow I need to upgrade my python version? Then I 
> need to recompile mod_wsgi too. Looks complicated :(

I don't see why you'd need to recompile Apache, but yeah, it's a little 
complicated. Here's a discussion: 
http://code.google.com/p/modwsgi/wiki/InstallationIssues

Notice that you don't necessarily have to recompile mod_wsgi for a Python 
patch-level upgrade (third digit).

FWIW, I've done this both ways. Under Ubuntu, I built both Python and mod_wsgi 
to get 2.7.3. When I moved to RHEL, I decided that I could live with Python 
2.6, and didn't bother with Python (though I did have to rebuild mod_wsgi for 
other reasons).

If you *do* build, I suggest using a tool like Fabric to encapsulate the 
process, so you can repeat it as required. Among other things, that makes 
building new servers or moving to later versions a lot easier. Here's my 
current fab script (note that it's oriented toward RHEL, but the Ubuntu details 
should be similar). The commented-out --with-python option lets you specify a 
non-system Python for the build.

@roles('web')
def install_wsgi():
if env.os == 'rhel':
e = dict(wsgi_version = '3.3')
with cd('/tmp'):
run('wget -nv 
http://modwsgi.googlecode.com/files/mod_wsgi-{wsgi_version}.tar.gz'.format(**e))
run('tar xvfz mod_wsgi-{wsgi_version}.tar.gz'.format(**e))
with cd('/tmp/mod_wsgi-{wsgi_version}'.format(**e)):
#./configure --with-python=/usr/local/bin/python
run('./configure')
run('make')
sudo('make install')
sudo('echo "LoadModule wsgi_module modules/mod_wsgi.so" > 
{apachedir}/conf.d/wsgi.conf'.format(**env))

-- 





[web2py] Re: Giving a talk promoting web2py over Django

2012-08-01 Thread Luther Goh Lu Feng
Backward compatibilty is a strong plus for me especially for very old 
sites that you leave idle for a long time and then want to upgrade to the 
latest web2py version

On Thursday, August 2, 2012 12:22:57 AM UTC+8, Anthony wrote:
>
> http://www.quora.com/What-are-the-advantages-of-web2py-over-Django
>
> On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:
>>
>> Tonight I'm going to present my little social-network to a user-group.
>>
>> I'm going to show them my code, some slides, the website, the mobile apps 
>> and tell them when Django isn't as good as web2py.
>>
>> Are there any particular features of web2py you would recommend I 
>> highlight? - Also, are there any major drawbacks in Django that web2py has 
>> that is easily advertisable?
>>
>> (I have a slide or two on this, but I'm sure as longtime users/developers 
>> of web2py you'd have more to pitch-in)
>>
>> Thanks for all information,
>>
>> Alec Taylor
>>
>

-- 





[web2py] Re: Giving a talk promoting web2py over Django

2012-08-01 Thread Anthony
If it's a Django-friendly crowd, it might also be helpful to be prepared to 
handle the inevitable criticisms that will come. The big issues that tend 
to arise are (a) global objects/lack of imports/lack of explicitness/too 
much magic, (b) use of exec, and (c) pure Python in views. The links below 
address these and other criticisms.

   - 
   
http://www.quora.com/Is-web2py-a-good-Python-web-framework/answer/Anthony-Bastardi
 (scroll 
   a bit for response to criticism by Jacob Kaplan-Moss, creator of Django).
   - https://groups.google.com/forum/#!msg/web2py/uIYf-dTjd88/P8yxUQwTZk4J
   - http://news.ycombinator.com/item?id=3767009
   - 
   http://greg.thehellings.com/2011/01/python-web2py-or-django/#comment-546
   - 
   
http://www.quora.com/What-are-the-advantages-of-web2py-over-Django/answer/Daniel-Greenfeld/comment/478595
 (addressing 
   criticism of pure Python in views)
   
And a little support from Zed Shaw regarding "magic": 
https://twitter.com/zedshaw/status/80415443558477825, 
https://twitter.com/zedshaw/status/80418794526351360

Anthony

On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:
>
> Tonight I'm going to present my little social-network to a user-group.
>
> I'm going to show them my code, some slides, the website, the mobile apps 
> and tell them when Django isn't as good as web2py.
>
> Are there any particular features of web2py you would recommend I 
> highlight? - Also, are there any major drawbacks in Django that web2py has 
> that is easily advertisable?
>
> (I have a slide or two on this, but I'm sure as longtime users/developers 
> of web2py you'd have more to pitch-in)
>
> Thanks for all information,
>
> Alec Taylor
>

-- 





Re: [web2py] Re: A Web2py CMS like Joomla ?

2012-08-01 Thread Massimo Di Pierro
I believe Marin is already working on improving the appliances site.

On Wednesday, 1 August 2012 10:52:28 UTC-5, Anthony wrote:
>
> On Wednesday, August 1, 2012 11:37:03 AM UTC-4, Massimo Di Pierro wrote:
>>
>> We could make that distinction (additional flag) and have two tabs.
>>
>
> We could, though see my other reply. Not all derivatives/distributions 
> have a running demo site, so it's probably best to include those kinds of 
> projects in http://www.web2py.com/appliances. It might make more sense to 
> enhance the appliances site -- (a) let users add projects, (b) enable 
> linking to other repos (besides the github web2py-appliances master repo), 
> (c) enable tagging, (d) enable linking to running demo sites or project 
> sites (in addition to the source code repo), (e) allow flagging of featured 
> sites to be displayed more prominently. Ultimately, it might make sense to 
> have a single site for both appliances and plugins working in this way. 
> Note, I believe web2pyslices 2.0 was originally intended to include this 
> functionality (i.e., in addition to posting recipes, questions, and 
> articles, it was supposed to allow posting of plugins and applications).
>
> Anthony
>

-- 





Re: [web2py] Re: Vars dictionary -- legal to have 'int'?

2012-08-01 Thread Massimo Di Pierro
yes but by converting the object to string we can see what it is in the 
generated url. I cannot reproduce the problem.

On Wednesday, 1 August 2012 10:54:10 UTC-5, Jonathan Lundell wrote:
>
> On 1 Aug 2012, at 8:42 AM, Massimo Di Pierro  
> wrote:
>
> in trunk. please check it.
>
>
> Per my earlier message, this should not be necessary. There must be 
> something else wrong, and str() unfortunately just papers over whatever the 
> real problem is.
>
>
> On Wednesday, 1 August 2012 10:23:11 UTC-5, AbrahamLinksys wrote:
>>
>> Hi,
>>
>> I have an appilcation that has been running for a while, and suddenly 
>> today it gave an error on this line in my view:
>>
>>  
>>   [show 
>> all attachements]
>>
>> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and 
>> it throws an error complaining that it cannot concatenate string and int 
>> types (because of dict(all=1) instead of all='1')
>>
>> Of course, the error can be fixed by passing a string literal or calling 
>> str() on the int, but i was curious if this intended? 
>>
>> I haven't been very careful to only use string vars, assuming that my 
>> laziness would be corrected by some gluonic magic. 
>>
>> Am I supposed to have always been passing only strings as vars? Should I 
>> be proactive and hunt down places in my code in other applications (which 
>> are still using slightly older web2py versions) or is this something that 
>> might change back to being able to use integers? 
>>
>> Just curious. Here's the relevant part of the traceback:
>>
>>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
>> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
>> TypeError: cannot concatenate 'str' and 'int' objects
>>
>>
>> If the "other+=" line were rewritten as such, would it be a bad thing for 
>> any reason?
>>
>> other += '?%s' % '&'.join([*str(*var[0]*)*+'='+str(var[1]) for var in 
>> list_vars])
>>
>>
>> Thanks,
>>
>> Abe
>>
>>
> -- 
>  
>
>
>
>

-- 





Re: [web2py] Re: web2py hangs while creating the mysql tables

2012-08-01 Thread Massimo Di Pierro
Try

Field('City', 'list:reference City', label='Miestas'),

On Wednesday, 1 August 2012 11:05:02 UTC-5, Aurelijus Useckas wrote:
>
> tried it, still the same error :( thnx anyway
>
> On Wednesday, August 1, 2012 6:31:52 PM UTC+3, Massimo Di Pierro wrote:
>>
>> Yes. this is wrong:
>>
>> Field('City', db.city, 'list:reference city', label='Miestas'),
>>
>> should be
>>
>> Field('City', 'list:reference city', label='Miestas'),
>>
>> On Wednesday, 1 August 2012 09:15:07 UTC-5, Aurelijus Useckas wrote:
>>>
>>> Thank you Massimo, but the 1005/150 mysql problem seems to be smth wring 
>>> with foreign key (merging of tables). Are there any flaws in my DAL syntax? 
>>>
>>> This line seems to be the trigger:
>>> Field('City', db.city, 'list:reference city', label='Miestas'),
>>>
>>> it references:
>>>
>>> db.define_table('city',
>>> Field('name', notnull=True, unique=True),
>>> format='%(name)s')
>>>
>>> any ideas what's bothering mysql? 
>>>
>>>
>>> On Wednesday, August 1, 2012 4:56:03 PM UTC+3, Massimo Di Pierro wrote:

 db = DAL('mysql://', check_reserved=['common','mysql'])

 Anyway, I am not sure your problem is that you are using  a reserved 
 keyword. Perhaps the table exists already. I am also surprised you are 
 getting a pymysql InternalError and not an OperationalError.

 On Wednesday, 1 August 2012 07:45:01 UTC-5, Aurelijus Useckas wrote:
>
> I've changed the long into longitude and it seems to be solved but I 
> still get errors:
>
> p2
> S' (1005, u"Can\'t 
> create table \'./lpkdb/asoc.frm\' (errno: 150)")'
>
> Now it says it cannot create next table, which is:
>
> db.define_table('asoc',
> Field('name', label='Pavadinimas', unique=True),
> Field('City', db.city, 'list:reference city', label='Miestas'),
> Field('address', label='Adresas'),
> Field('www'),
> Field('tel'),
> Field('fax'),
> Field('email'),
> Field('President', label='Asociacijos prezidentas'),
> Field('CEO', label='Asociacijos generalinis'),
> Field('CEO_tel', label='Generalinio tel.'),
> Field('CEO_email', label='Generalinio email'),
> Field('CEO_mob', label='Generalinio mobilus'),
> Field('Pres_tel', label='Prezidento tel.'),
> Field('Pres_email', label='Prezidento email'),
> Field('Pres_mob', label='Prezidento mobilus'),
> Field('submited_at', 'datetime', default=request.now, 
> writable=False, readable=False),
> Field('updated_at', 'datetime', default=request.now, 
> update=request.now, writable=False, readable=False),
> Field('submited_by', db.auth_user, default=auth.user_id, 
> writable=False, readable=False),
> Field('updated_by', db.auth_user, update=auth.user_id, 
> writable=False, readable=False),
> format='%(name)s')
>
> Are there some guidlines on how to construct DAL field names in order 
> to avoid any conflict while migrating to mysql?
>  
>
> On Wednesday, August 1, 2012 3:36:51 PM UTC+3, tomasz bandura wrote:
>>
>> Is it 'long' a mysql's reserved word?
>>
>> Regards
>> Tomasz
>>
>> 2012/8/1 Aurelijus Useckas 
>>
>>> this is the trigger i guess:
>>>
>>> db.define_table('maps',
>>> Field('name'),
>>> Field('last_name'),
>>> Field('long'),
>>> Field('lat'),
>>> format='%(name)s')
>>>
>>> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas 
>>> wrote:

 Hi, 

 I've built the app on SQLite and now want to migrate to the server 
 based mysql. BUT web2py hangs in the middle of creating, basicaly just 
 after the auth tables. When I restart the apache I can see auth tables 
 as 
 well as a few from my app.

 this is the err ticket that I get:

 (dp1
 S'output'
 p2
 S' (1064, 
 u"You have an error in your SQL syntax; check the manual that 
 corresponds 
 to your MySQL server version for the right syntax to use near \'long 
 VARCHAR(255),\\nlat VARCHAR(255),\\nPRIMARY KEY(id)\\n) 
 ENGINE=InnoDB CHA\' at line 5")'
 p3
 sS'layer'
 p4
 S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py'
 p5
 sS'code'
 p6

 thnx

>>>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>

-- 





Re: [web2py] Re: Vars dictionary -- legal to have 'int'?

2012-08-01 Thread Jonathan Lundell
On 1 Aug 2012, at 10:02 AM, Massimo Di Pierro  
wrote:
> yes but by converting the object to string we can see what it is in the 
> generated url. I cannot reproduce the problem.

My point, though, is that if it's not *already* a string (and url-encoded to 
boot), it's an error, and if it happens to throw an exception, that's good and 
should not be suppressed, though of course an exception is not guaranteed.

> 
> On Wednesday, 1 August 2012 10:54:10 UTC-5, Jonathan Lundell wrote:
> On 1 Aug 2012, at 8:42 AM, Massimo Di Pierro  
> wrote:
>> in trunk. please check it.
> 
> Per my earlier message, this should not be necessary. There must be something 
> else wrong, and str() unfortunately just papers over whatever the real 
> problem is.
> 
>> 
>> On Wednesday, 1 August 2012 10:23:11 UTC-5, AbrahamLinksys wrote:
>> Hi,
>> 
>> I have an appilcation that has been running for a while, and suddenly today 
>> it gave an error on this line in my view:
>> 
>>  
>>   [show 
>> all attachements]
>> 
>> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and it 
>> throws an error complaining that it cannot concatenate string and int types 
>> (because of dict(all=1) instead of all='1')
>> 
>> Of course, the error can be fixed by passing a string literal or calling 
>> str() on the int, but i was curious if this intended? 
>> 
>> I haven't been very careful to only use string vars, assuming that my 
>> laziness would be corrected by some gluonic magic. 
>> 
>> Am I supposed to have always been passing only strings as vars? Should I be 
>> proactive and hunt down places in my code in other applications (which are 
>> still using slightly older web2py versions) or is this something that might 
>> change back to being able to use integers? 
>> 
>> Just curious. Here's the relevant part of the traceback:
>> 
>>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
>> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
>> TypeError: cannot concatenate 'str' and 'int' objects
>> 
>> If the "other+=" line were rewritten as such, would it be a bad thing for 
>> any reason?
>> other += '?%s' % '&'.join([str(var[0])+'='+str(var[1]) for var in 
>> list_vars])
>> 
>> Thanks,
>> Abe
>> 
>> -- 
>>  
> 
> 
> 
> -- 
>  
>  
>  


-- 





Re: [web2py] Re: Vars dictionary -- legal to have 'int'?

2012-08-01 Thread AbrahamLinksys
Hmm, I tried again with a simpler example in an app built from the welcome 
app.

I got the same error, but I noticed this:

(a=None, c=None, f=None, r=, 'post_vars': }>, args=[], vars={'a': 
2}, anchor='', extension=None, env=, 
hmac_key=None, hash_vars=True, salt=None, user_signature=None, scheme=None, 
host=None, port=None, encode_embedded_slash=False, *url_encode=False*)

As you can see, url_encode is set to false... I double checked the version, 
and it is 1.99.7 (i printed out request.env.web2py_version from the app 
just to be sure, as I have several web2py versions on the test server, so I 
possibly have done something silly somewhere). 

However, when I launch an app with python web2py.py -M -S , I do not 
in fact get the error, leading me to believe I AM doing something silly. 

Any idea where I can look to see how the url_encode might be getting set to 
false?

On Wednesday, August 1, 2012 10:54:10 AM UTC-5, Jonathan Lundell wrote:
>
> On 1 Aug 2012, at 8:42 AM, Massimo Di Pierro  
> wrote:
>
> in trunk. please check it.
>
>
> Per my earlier message, this should not be necessary. There must be 
> something else wrong, and str() unfortunately just papers over whatever the 
> real problem is.
>
>
> On Wednesday, 1 August 2012 10:23:11 UTC-5, AbrahamLinksys wrote:
>>
>> Hi,
>>
>> I have an appilcation that has been running for a while, and suddenly 
>> today it gave an error on this line in my view:
>>
>>  
>>   [show 
>> all attachements]
>>
>> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and 
>> it throws an error complaining that it cannot concatenate string and int 
>> types (because of dict(all=1) instead of all='1')
>>
>> Of course, the error can be fixed by passing a string literal or calling 
>> str() on the int, but i was curious if this intended? 
>>
>> I haven't been very careful to only use string vars, assuming that my 
>> laziness would be corrected by some gluonic magic. 
>>
>> Am I supposed to have always been passing only strings as vars? Should I 
>> be proactive and hunt down places in my code in other applications (which 
>> are still using slightly older web2py versions) or is this something that 
>> might change back to being able to use integers? 
>>
>> Just curious. Here's the relevant part of the traceback:
>>
>>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
>> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
>> TypeError: cannot concatenate 'str' and 'int' objects
>>
>>
>> If the "other+=" line were rewritten as such, would it be a bad thing for 
>> any reason?
>>
>> other += '?%s' % '&'.join([*str(*var[0]*)*+'='+str(var[1]) for var in 
>> list_vars])
>>
>>
>> Thanks,
>>
>> Abe
>>
>>
> -- 
>  
>
>
>
>
On Wednesday, August 1, 2012 10:54:10 AM UTC-5, Jonathan Lundell wrote:
>
> On 1 Aug 2012, at 8:42 AM, Massimo Di Pierro  
> wrote:
>
> in trunk. please check it.
>
>
> Per my earlier message, this should not be necessary. There must be 
> something else wrong, and str() unfortunately just papers over whatever the 
> real problem is.
>
>
> On Wednesday, 1 August 2012 10:23:11 UTC-5, AbrahamLinksys wrote:
>>
>> Hi,
>>
>> I have an appilcation that has been running for a while, and suddenly 
>> today it gave an error on this line in my view:
>>
>>  
>>   [show 
>> all attachements]
>>
>> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and 
>> it throws an error complaining that it cannot concatenate string and int 
>> types (because of dict(all=1) instead of all='1')
>>
>> Of course, the error can be fixed by passing a string literal or calling 
>> str() on the int, but i was curious if this intended? 
>>
>> I haven't been very careful to only use string vars, assuming that my 
>> laziness would be corrected by some gluonic magic. 
>>
>> Am I supposed to have always been passing only strings as vars? Should I 
>> be proactive and hunt down places in my code in other applications (which 
>> are still using slightly older web2py versions) or is this something that 
>> might change back to being able to use integers? 
>>
>> Just curious. Here's the relevant part of the traceback:
>>
>>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
>> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
>> TypeError: cannot concatenate 'str' and 'int' objects
>>
>>
>> If the "other+=" line were rewritten as such, would it be a bad thing for 
>> any reason?
>>
>> other += '?%s' % '&'.join([*str(*var[0]*)*+'='+str(var[1]) for var in 
>> list_vars])
>>
>>
>> Thanks,
>>
>> Abe
>>
>>
> -- 
>  
>
>
>
>

-- 





[web2py] Re: format attribute in Record Representation

2012-08-01 Thread lyn2py
I'm trying to understand...

Do you mean that if I leave out the validator, i.e. make it

requires=IS_IN_DB(db,'sometable.id')

or do you mean to remove the whole "requires" attribute?

Yes, they are exactly the same (the format attributes in table and in the 
reference), and I don't wish to repeat them either, but how do I get the 
drop down menus with the correct formatting?

I have tried different combinations but the correct referencing with drop 
down menus still doesn't work. These are my tables, please kindly help.

db.define_table('health',
Field('type_id','reference types',requires=IS_IN_DB(db,'types.id',
'%(name)s (%(description)s)
') ),
Field('time_min','string',length=255,requires=IS_NOT_EMPTY()),
Field('time_max', 'string',length=255),
Field('tab_id','reference tabs',requires=IS_IN_DB(db,'tabs.id',
'%(name)s') ),
)


db.define_table('types',
Field('name','string',length=255,requires=IS_NOT_EMPTY()),
Field('description','text',requires=IS_NOT_EMPTY()),
format='%(name)s (%(description)s)'
)


db.define_table('tabs',
Field('name','string',length=255,requires=IS_NOT_EMPTY()),
Field('description','text',requires=IS_NOT_EMPTY()),
format='%(name)s'
)

I would like to have the drop down menu available for choosing AND for the 
correct format for referencing when listing the items. Am I writing the 
wrong code?

I have tried:

   - removing the "format" attribute in the "requires=" attribute
  - drop down menus available but the format is the ID 
   

   - removing the entire "requires" attribute
  - no drop down menus
   
The "represent" solution works, but I was wondering if there was a way 
about it, since the web2py manual says so and if I understand your reply 
correctly, I'm probably doing it wrong somewhere.

I have many references, so there will be lambdas all over the place. Not 
very DRY... Can I learn the correct method to achieve this please?

Thank you!

On Thursday, August 2, 2012 12:18:54 AM UTC+8, Anthony wrote:
>
> Do you mean like:
>>
>> requires=IS_IN_DB(db,'sometable.id','%(name)s (%(description)s)')
>>
>> If so, yes I have them there. The purpose is to create the drop down 
>> menu... unless I'm doing it wrong? Or is there another way about it so that 
>> the references will appear per the manual?
>>
>
> Yes, that's what I mean. By specifying the validator, you no longer get 
> the default "represent" attribute. Is '%(name)s (%(description)s)' the 
> same as the "format" attribute of the db.sometable table? If so, there's no 
> reason to explicitly specify that validator, as you will get exactly that 
> validator by default anyway (in which case, you will also get the default 
> "represent" attribute).
>
> Alternatively, you can do:
>
> Field('sometable', db.sometable, requires=IS_IN_DB(...),
> represent=lambda id, row: db.sometable._format % db.sometable(id))
>
> Anthony
>

-- 





[web2py] Re: Giving a talk promoting web2py over Django

2012-08-01 Thread Massimo Di Pierro
I really have nothing to add but some history. 

I was a Django programmer (although never a Django contributor) and I have 
developed web sites for the United Nations in Django. I have taught Django 
here at DePaul University. I started web2py as a teaching because I found 
the learning curve with Django was too steep. Moreover when web2py was 
created Django was not the same as today. It did not have the template 
escaping on by default (web2py did), it had a bug in CSRF protection 
(web2py's one always worked), did not have migration (still does not but 
now there is third party solution), did not support multiple database 
connections (there was as Django fork but it took long time to be merged), 
did not support multiple projects (web2py always did), did not support left 
joins and aggregates (web2py always did). Django always supported less 
database engine than web2py (and some not very well, for example web2py 
generates better SQL code for pagination in Oracle). Django always had and 
still has a more polised and customizable admin (equivalent to web2py's 
appadmin) and a better interface for many-to-many relations.

They are philosophically differences:
Django preferes "explicit is better than implicit" so you have do define 
lots of boilerplate
web2py says "do not repeat yourself" so you have lots of 
default behavior (magic?) but documented and backward compatible.

Other communities have used various arguments to criticize some web2py's 
design decisions. All design decisions have pros and cons. Some of 
the criticism has legs and some has not. What is important is that those 
decisions were not motivated by ignorance but by carefully considering 
the alternatives. As a result of those design decision web2py is the only 
framework that allows hot install and uninstall of apps without restarting 
the web server (with any web server) and supports multiple projects under 
one web2py instance without library conflicts.

I also want to stress that our community is very friendly. We have always 
shown great respect for other people's work and we have tried to learn from 
them. We have taken ideas from Django, TG, Flask, etc and we proudly 
acknowledged it.

Massimo




On Wednesday, 1 August 2012 11:55:32 UTC-5, Anthony wrote:
>
> If it's a Django-friendly crowd, it might also be helpful to be prepared 
> to handle the inevitable criticisms that will come. The big issues that 
> tend to arise are (a) global objects/lack of imports/lack of 
> explicitness/too much magic, (b) use of exec, and (c) pure Python in views. 
> The links below address these and other criticisms.
>
>- 
>
> http://www.quora.com/Is-web2py-a-good-Python-web-framework/answer/Anthony-Bastardi
>  (scroll 
>a bit for response to criticism by Jacob Kaplan-Moss, creator of Django).
>- https://groups.google.com/forum/#!msg/web2py/uIYf-dTjd88/P8yxUQwTZk4J
>- http://news.ycombinator.com/item?id=3767009
>- http://www.web2py.com/AlterEgo/default/show/271
>- 
>http://greg.thehellings.com/2011/01/python-web2py-or-django/#comment-546
>- 
>
> http://www.quora.com/What-are-the-advantages-of-web2py-over-Django/answer/Daniel-Greenfeld/comment/478595
>  (addressing 
>criticism of pure Python in views)
>
> And a little support from Zed Shaw regarding "magic": 
> https://twitter.com/zedshaw/status/80415443558477825, 
> https://twitter.com/zedshaw/status/80418794526351360
>
> Anthony
>
> On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:
>>
>> Tonight I'm going to present my little social-network to a user-group.
>>
>> I'm going to show them my code, some slides, the website, the mobile apps 
>> and tell them when Django isn't as good as web2py.
>>
>> Are there any particular features of web2py you would recommend I 
>> highlight? - Also, are there any major drawbacks in Django that web2py has 
>> that is easily advertisable?
>>
>> (I have a slide or two on this, but I'm sure as longtime users/developers 
>> of web2py you'd have more to pitch-in)
>>
>> Thanks for all information,
>>
>> Alec Taylor
>>
>

-- 





Re: [web2py] Re: Vars dictionary -- legal to have 'int'?

2012-08-01 Thread Jonathan Lundell
On 1 Aug 2012, at 10:11 AM, AbrahamLinksys  wrote:
> Hmm, I tried again with a simpler example in an app built from the welcome 
> app.
> 
> I got the same error, but I noticed this:
> 
> (a=None, c=None, f=None, r= 0..._vars': , 'post_vars': }>, args=[], vars={'a': 
> 2}, anchor='', extension=None, env= 'http_user_agent':...[]), 'query_string': '', 'wsgi_run_once': False}>, 
> hmac_key=None, hash_vars=True, salt=None, user_signature=None, scheme=None, 
> host=None, port=None, encode_embedded_slash=False, url_encode=False)
> 
> As you can see, url_encode is set to false... I double checked the version, 
> and it is 1.99.7 (i printed out request.env.web2py_version from the app just 
> to be sure, as I have several web2py versions on the test server, so I 
> possibly have done something silly somewhere). 
> 
> However, when I launch an app with python web2py.py -M -S , I do not in 
> fact get the error, leading me to believe I AM doing something silly. 
> 
> Any idea where I can look to see how the url_encode might be getting set to 
> false?
> 

Try a search of your entire source tree for 'url_encode'. In my fresh download 
of 1.99.7 (and for that matter in the trunk) the only references are in 
gluon/html.py and a couple of related html pages in the examples app.

-- 





[web2py] Re: Centos 5 script for Nginx with Uwsgi and Web2py

2012-08-01 Thread Alan Etkin

>
>
> I have got through 5 issues on your instructions so far:
>
>
> 'force-reload' not recognised so removed from uwsgi
>
>
Didn't test that command, it came with the example uwsgi startup script, 
but I think there's no need of it

'tar's had '-zxvf' as options, changed to 'zxvf'
>
tar man page examples use dash, perhaps it accepts both syntaxes. 

'cp -R ./$version/* /opt/uwsgi-python/*'
>
> changed to 
>
> 'cp -R ./$version/* /opt/uwsgi-python'
>
>
The second argument of cp is not a valid location. My bad.
 

> after 
>
> "cd /opt/uwsgi-python
>
> echo 'build using python 2.7'
> python2.7 setup.py build"
>
> I get ImportError no module named setuptools.
>
>
The setup script must be trying to import python libraries not installed, 
However, that command is not mandatory for building uwsgi. It should be 
enough to call

python2.7 uwsgiconfig.py --build

If that command builds uwsgi successfully under /opt/uwsgi-python, the script 
start command should work

-- 





Re: [web2py] Web2py in apache mod_wsgi with virtualenv

2012-08-01 Thread Daniel Gonzalez
Thanks Jonathan,

I will try this later today.

Regards,
Daniel

On Wednesday, August 1, 2012 6:44:24 PM UTC+2, Jonathan Lundell wrote:
>
> On 1 Aug 2012, at 9:30 AM, Daniel Gonzalez  wrote: 
> > On Wednesday, August 1, 2012 5:56:37 PM UTC+2, Jonathan Lundell wrote: 
> > On 1 Aug 2012, at 8:52 AM, Daniel Gonzalez  wrote: 
> >> Quoting from the link you posted: 
> >> 
> >> "The purpose of such Python virtual environments is to allow one to 
> create multiple distinct Python environments for the same version of 
> Python, but with different sets of Python modules and packages installed 
> into the Python 'site-packages' directory." 
> > 
> > It (virtualenv) also supports different Python versions. Note later in 
> the text where they talk about making sure that your mod_wsgi is built with 
> the Python version you're using in the virtualenv. 
> > 
> > I am not building mod_wsgi: I am installing it with apt-get install. I 
> do not know which is the version it was compiled for, since it comes 
> pre-packaged with the apache ubuntu distribution. I assume it is the 
> system-wide python version (2.6.5). 
> > 
> > But I need to use the python version in my virtualenv for my web2py 
> application (2.7.2). Running *any* python script with *any* python 
> interpreter is usually as easy as making sure that the right python 
> interpreter is selected, by setting the PATH, and putting "#!/usr/bin/env 
> python" on top of the python script. Why is mod_python different in this 
> regard? Isn't it basically a wrapper to call the python interpreter? 
>
> I'm guessing because it's got some C components, and needs to be compiled 
> against the same headers and libraries as the Python binary. 
>
> > Do you think there is any chance at all of using the python version in 
> my virtualenv without having to recompile mod_wsgi? 
> > 
> > I am afraid that if I start recompiling mod_wsgi this will prove very 
> complicated, and it will even force me to recompile apache ... 
> > Besides, what happens if tomorrow I need to upgrade my python version? 
> Then I need to recompile mod_wsgi too. Looks complicated :( 
>
> I don't see why you'd need to recompile Apache, but yeah, it's a little 
> complicated. Here's a discussion: 
> http://code.google.com/p/modwsgi/wiki/InstallationIssues 
>
> Notice that you don't necessarily have to recompile mod_wsgi for a Python 
> patch-level upgrade (third digit). 
>
> FWIW, I've done this both ways. Under Ubuntu, I built both Python and 
> mod_wsgi to get 2.7.3. When I moved to RHEL, I decided that I could live 
> with Python 2.6, and didn't bother with Python (though I did have to 
> rebuild mod_wsgi for other reasons). 
>
> If you *do* build, I suggest using a tool like Fabric to encapsulate the 
> process, so you can repeat it as required. Among other things, that makes 
> building new servers or moving to later versions a lot easier. Here's my 
> current fab script (note that it's oriented toward RHEL, but the Ubuntu 
> details should be similar). The commented-out --with-python option lets you 
> specify a non-system Python for the build. 
>
> @roles('web') 
> def install_wsgi(): 
> if env.os == 'rhel': 
> e = dict(wsgi_version = '3.3') 
> with cd('/tmp'): 
> run('wget -nv 
> http://modwsgi.googlecode.com/files/mod_wsgi-{wsgi_version}.tar.gz'.format(**e))
>  
>
> run('tar xvfz mod_wsgi-{wsgi_version}.tar.gz'.format(**e)) 
> with cd('/tmp/mod_wsgi-{wsgi_version}'.format(**e)): 
> #./configure --with-python=/usr/local/bin/python 
> run('./configure') 
> run('make') 
> sudo('make install') 
> sudo('echo "LoadModule wsgi_module modules/mod_wsgi.so" > 
> {apachedir}/conf.d/wsgi.conf'.format(**env)) 
>
>

-- 





[web2py] Re: Vars dictionary -- legal to have 'int'?

2012-08-01 Thread AbrahamLinksys
Wow, I certainly did something silly at some point -- in my source 
(gluon/html.py), url_encode is set to false:

I checked out a new version, and the build times match 100%, so it HAS to 
be my silliness (Version 1.99.7 (2012-03-04 22:12:08) stable).  

Apologies for the wild goose chase -- I seem to remember debugging some 
issue I was having with URLs from another app that linked to this one... 
anyway, I clearly was careless in that I modified the source and forgot to 
change it back.

Thanks for your help. 

-Abe

On Wednesday, August 1, 2012 10:23:11 AM UTC-5, AbrahamLinksys wrote:
>
> Hi,
>
> I have an appilcation that has been running for a while, and suddenly 
> today it gave an error on this line in my view:
>
>   
>   [show 
> all attachements]
>
> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and 
> it throws an error complaining that it cannot concatenate string and int 
> types (because of dict(all=1) instead of all='1')
>
> Of course, the error can be fixed by passing a string literal or calling 
> str() on the int, but i was curious if this intended? 
>
> I haven't been very careful to only use string vars, assuming that my 
> laziness would be corrected by some gluonic magic. 
>
> Am I supposed to have always been passing only strings as vars? Should I 
> be proactive and hunt down places in my code in other applications (which 
> are still using slightly older web2py versions) or is this something that 
> might change back to being able to use integers? 
>
> Just curious. Here's the relevant part of the traceback:
>
>   File "/usr/web2py-latest/gluon/html.py", line 330, in URL
> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
> TypeError: cannot concatenate 'str' and 'int' objects
>
>
> If the "other+=" line were rewritten as such, would it be a bad thing for any 
> reason?
>
> other += '?%s' % '&'.join([*str(*var[0]*)*+'='+str(var[1]) for var in 
> list_vars])
>
>
> Thanks,
>
> Abe
>
>

-- 





[web2py] Re: JSONRPC authentication without disabling normal authentication?

2012-08-01 Thread howesc
for Starmaker's API we are now using the @restful decorator chained with a 
decorator we wrote that checks OAuth.  all requests made by the client are 
OAuth signed requests.  i'm sure you can use a similar method to use basic 
auth for the API calls, while leaving the regular auth decorators for the 
non-API calls.

(note that i'm not using phonegap so i don't have phonegap specific advice 
at this time)

cfhj

On Tuesday, July 31, 2012 9:23:17 AM UTC-7, Alec Taylor wrote:
>
> Practically just finished my little proof-of-concept social-network 
> backend (DAL+controller) & web-frontend (web2py views).
>
> Now I plan to make the mobile app with PhoneGap . 
> PhoneGap allows you to create native mobile-apps for 7 different mobile 
> platforms in HTML+JS+CSS.
>
> I plan on developing this frontend first by exposing JSONRPC methods 
> server-side—by decorating controllers—then interfacing with the API on the 
> client-side using JavaScript.
>
> Reading "web2py Application Development Cookbook", and on page 217 
> (chapter 7) it tells me that to make authentication work for RPC calls I 
> need to break regular authentication methods.
>
> Is there a way to avoid this? — Note that I'm currently logging in using 
> the normal method, but will be using Facebook auth in production.
>
> Also, if there is a way to avoid rewriting the frontend from scratch that 
> will work with PhoneGap, please tell me.
>
> Thanks for all suggestions,
>
> Alec Taylor
>

-- 





Re: [web2py] Re: passing javascript variables to python code in web2py view

2012-08-01 Thread howesc
in these cases i do all the python on the server side and format the 
resulting JSON in a way that i can handle easily in javascript.  we don't 
yet have web browsers that run python. :(

On Monday, July 30, 2012 1:58:22 PM UTC-7, curiouslearn wrote:
>
> Anthony, thanks for your response. Please see the response below. 
>
> I was trying to do the following. Read data from a database and add it 
> to a table on the html page using ajax. I am using the standard ajax 
> functions available in jquery. The controller function sends the 
> database output in the form of json. I wanted to add this output to 
> the table. Currently, I am just using javascript to do so, but I 
> thought that for a more complicated scenario, it may be useful if I 
> could use python. In hindsight, I should have tried to see if python 
> can directly read the json format output sent by the controller 
> function. Please see the relevant controller function and the  part of 
> the view (with some comments added to explain what I was trying to 
> do). 
>
> Relevant controller function that is called by the Ajax code 
> - 
> import simplejson as sjson 
>
> def returndatafromdb(): 
> con, c = connecttodb() 
> c.execute('select * from results') 
> results = c.fetchall() 
> c.close() 
> con.close() 
> if len(results) > 0: 
>  return sjson.dumps(dict(results=results)) 
>
>
> Relevant part from the view 
> -- 
>
>  
> // Setting width of the table 
> $("#resultstable").attr('width', "300px"); 
> // Aligning text to center 
> $("table").css("text-align", "center"); 
>
> $.ajaxSetup({ 
> cache: false 
> }); 
>
> var loadurl = "{{=URL('default', 'returndatafromdb')}}"; 
>
> var numrows = 0; 
> var getdata = function(){ 
> $.post( 
> loadurl, 
> null, 
> function(serverresponse){  // serverresponse is in json format 
> var results = serverresponse.results; 
>
> // Instead of following javascript, I was wondering if 
> I could use 
> // web2py TR() and TD() helpers. But for that I need 
> to read "results" 
> // which is a javascript variable. 
>
> if (results.length > numrows) { 
> for (var i=0; i < results.length; i++) { 
> tablerow = "" + results[i][1] + "" + 
>"" + results[i][2] + "" + 
> ""; 
> $(tablerow).appendTo("#resultstable"); 
> }; 
> }; 
> numrows = results.length; 
> }, 
> "json" 
> ); 
> }; 
>
> var checkdatabase = function(){ 
> getdata(); 
> setTimeout(checkdatabase, 6000); 
> } 
>
> $('#b1').click(checkdatabase); 
>
>
>
> == 
>
> On Mon, Jul 30, 2012 at 1:59 PM, Anthony wrote: 
> > What are you trying to do? Note, the Python code in the view is executed 
> on 
> > the server side, before the HTML page is sent to the browser. The 
> Javascript 
> > code is executed by the browser itself once the HTML page has been 
> rendered. 
> > Once the page is in the browser, no Python code can run there -- your 
> Python 
> > code and Javascript cannot iteract. You can use Python to write 
> Javascript 
> > on the server, but the Python cannot dynamically generate or change the 
> > Javascript in the browser. 
> > 
> > Anthony 
> > 
> > 
> > On Monday, July 30, 2012 1:55:14 PM UTC-4, curiouslearn wrote: 
> >> 
> >> Is it possible to pass a javascript variable to python code in a 
> >> web2py view? The only questions and answers I have seen this in the 
> >> forum are about how to do this for the URL() function. I want to know 
> >> if this is possible for the "for" loop. 
> >> 
> >> For example: 
> >> 
> >>