[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-13 Thread Niphlod
because your update can be something like 

db((db.testtable.id50)  (db.testtable.articles.contains(['a','b']))

-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-13 Thread Bill Thayer
Do I then need to use an iterator for my update function?

This is related to my other post where I am getting key errors 
https://groups.google.com/d/msg/web2py/3dgZiuDAZDc/DZnJYgaifjIJ

-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-13 Thread Niphlod
Given the DAL syntax (and usual database triggers), saying that 
after_update(s,f) is called with s as the set of the updated values and f 
as the dict passed to the update seems not hard to grasp...

given

db((db.testtable.id50)  
(db.testtable.articles.contains(['a','b'])).update(somefield='aaa', 
otherfield='bbb')

after_update will be called with

s = db((db.testtable.id50)  (db.testtable.articles.contains(['a','b']))
f = dict(somefield='aaa', otherfield='bbb')


-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-12 Thread Bill Thayer
No the app never really got to 100%. Even when I try to simplify it farther 
and takes a different approach there is always a 'roadblock' of errors or 
related errors. I get about 90% (I feel) finished and can't get to the last 
10% without some round of errors that never gets 100% solved so I chalk it 
up to poor programing and study harder  simplify the design more. Spending 
so much time on the book and in the code is helpful but if there was a way 
to collect what the newbies are experiencing then some valuable index of 
errors or more focused documentation can be created. 


For exmample:
Today I'm trying to use ._after_insert_append(lambda f,id:... expecting f 
to be a dict however the book actually has two lambda functions (for after 
update  after insert) with the same signature but get passed different 
values.

So my frustration comes from not being able to find the correct way to 
access the Set object on the _after_update. Why cant they both just get 
dicts?

 db.define_table('person',Field('name'))
 def pprint(*args): print args
 db.person._before_insert.append(lambda f: pprint(f))
 db.person._after_insert.append(lambda f,id: pprint(f,id))
 db.person._before_update.append(lambda s,f: pprint(s,f))
 db.person._after_update.append(lambda s,f: pprint(s,f))
 db.person._before_delete.append(lambda s: pprint(s))
 db.person._after_delete.append(lambda s: pprint(s))



-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-09 Thread pbreit
Are you saying your app used to work but now it doesn't? I don't understand 
your problem exactly.


On Tuesday, November 6, 2012 5:34:40 PM UTC-8, Bill Thayer wrote:


 Didn't have ANY problems with this line of work in 2 years of deployment.


 So your post does help with migration errors but...

 I have 81 tickets today mostly related to lambda taking [1|2]  arguments 
 but only [0|1] given. This leads to all sorts of variations leading to 
 errors because sometimes '%(something)s' works and other times you just 
 need r.something  or simply lambda val: function(val).

 Much of my errors today were dealing with validators, looks like lambda 
 functions and validators I had last week are not working now. Just when I 
 figured my data tables were ready I have to go through each one line by 
 line and rewrite validators  lambda functions (and requires= and default= 
 etc) I've already removed most of my referenced fields.

 Hope you guys plan on having a web2py boot camp very soon. There have been 
 probably 74 or more posts made in this Google group in the last week so I 
 can't think that I'm alone. I've read most of the code, all of the book and 
 epidocs and most of the posts here and on stackoverflow. I bought the 
 application developement cookbook, tried the slices. Kept my versions up to 
 date etc...

 Still, I am probably going to get fired  divorced for this project being 
 so late after all the hours I put on it.

 -Bill
  


-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-06 Thread Bill Thayer


 Didn't have ANY problems with this line of work in 2 years of deployment.


So your post does help with migration errors but...

I have 81 tickets today mostly related to lambda taking [1|2]  arguments 
but only [0|1] given. This leads to all sorts of variations leading to 
errors because sometimes '%(something)s' works and other times you just 
need r.something  or simply lambda val: function(val).

Much of my errors today were dealing with validators, looks like lambda 
functions and validators I had last week are not working now. Just when I 
figured my data tables were ready I have to go through each one line by 
line and rewrite validators  lambda functions (and requires= and default= 
etc) I've already removed most of my referenced fields.

Hope you guys plan on having a web2py boot camp very soon. There have been 
probably 74 or more posts made in this Google group in the last week so I 
can't think that I'm alone. I've read most of the code, all of the book and 
epidocs and most of the posts here and on stackoverflow. I bought the 
application developement cookbook, tried the slices. Kept my versions up to 
date etc...

Still, I am probably going to get fired  divorced for this project being 
so late after all the hours I put on it.

-Bill
 

-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-05 Thread Niphlod
while developing you should NOT use any of the migrate, fake_migrate, 
migrate_enabled, etc. Zero tickets in regards of db migrations (unless you 
do something weird like trying to change a column type from string to 
integer).

The minute you go on production, deploy the app, hit the appadmin page (so 
all tables are created on your fresh production db), return to the db.py 
file and set migrate=False on the DAL.
Next iteration, you develop another piece of app, freeze it, update your 
production, set migrate=True on the DAL, re-hit the appadmin page, return 
to db.py and set migrate=False.
Next iteration, you screw some table (like converting a string column to an 
integer), the previous working method will NOT work (mostly because only 
you can know how to migrate that column (others call it fixturese.g. 
attempt a conversion and NULL all fields that doesn't cast to integers vs 
drop the column and readd and fill with default values, etc, etc, etc)). 
It's time to:
- manually alter the database (optionally applying your fixtures) so that 
the db reflects your model
- update your app
- optional step: set fake_migrate_all=True in the DAL, hit the appadmin 
page (so .table files are recreated) and reset fake_migrate_all to False
- set migrate=False on the DAL
- use you app

Didn't have ANY problems with this line of work in 2 years of deployment.

-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-05 Thread Bill Thayer
Niphold,

Really appreciate your taking the time to spell this procedure out. It will 
come in handy for me and others too I bet! 

Thanks,
Bill

--