I am trying to create the hours form in Step by step. I get this error and I can't find what is wrong. I have included the HoursBizobj.pyI am ok till I get the page 19 Dropdown List Control. I am confused by the creation of the HoursBizobj.py an placed in the biz folder. I use the Editor to CreateBizObj and wonder how they relate ???
============================================================== C:\dabo-0.9.2-win\dabo\projects\hours>main.py C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\lib\SimpleCrypt.py:32: U serWarning: WARNING: Your application uses SimpleCrypt, which is fine for testing but should not be used in production, because: 1) Anyone with a copy of Dabo could decrypt your password. 2) It isn't portable between 32-bit and 64-bit python. See the trac ticket at http://trac.dabodev.com/ticket/1179 for more information. """, UserWarning) Traceback (most recent call last): File "C:\dabo-0.9.2-win\dabo\projects\hours\main.py", line 12, in <module> app.start() File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\dApp.py", line 3 76, in start self.setup() File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\dApp.py", line 3 32, in setup self.initUIApp() File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\dApp.py", line 3 68, in initUIApp self.uiApp.setup() File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\uiApp.py ", line 406, in setup frm = self.dApp.MainForm = dabo.ui.createForm(mfc) File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\__init__ .py", line 1168, in createForm frm = cls(*args, **kwargs) File "c:\users\jim\appdata\local\temp\tmpeiu34a.py", line 126, in __init__ obj = self.getCustControlClass('dDropdownList_32020')(currParent) File "c:\users\jim\appdata\local\temp\tmpeiu34a.py", line 255, in __init__ dabo.ui.dDropdownList.__init__(self, parent=parent, attProperties=attPropert ies, *args, **kwargs) File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dDropdow nList.py", line 23, in __init__ dcm.dControlItemMixin.__init__(self, preClass, parent, properties, attProper ties, *args, **kwargs) File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dControl ItemMixin.py", line 20, in __init__ super(dControlItemMixin, self).__init__(*args, **kwargs) File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\ui\dDataControlM ixinBase.py", line 22, in __init__ dabo.ui.dControlMixin.__init__(self, *args, **kwargs) File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dPemMixi n.py", line 186, in __init__ self._afterInit() File "C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dPemMixi n.py", line 320, in _afterInit self.afterInit() File "c:\users\jim\appdata\local\temp\tmpeiu34a.py", line 264, in afterInit self.Defaultvalues = ("servicedate", datetime.date.today()) NameError: global name 'datetime' is not defined C:\dabo-0.9.2-win\dabo\projects\hours>c:\dabo-0.9.2-win\dabo\ide\Classdesigner.p y C:\dabo-0.9.2-win\dabo\projects\hours>c:\dabo-0.9.2-win\dabo\ide\Classdesigner.p y C:\Python25\lib\site-packages\dabo-0.9.2-py2.5.egg\dabo\lib\SimpleCrypt.py:32: U serWarning: WARNING: Your application uses SimpleCrypt, which is fine for testing but should not be used in production, because: 1) Anyone with a copy of Dabo could decrypt your password. 2) It isn't portable between 32-bit and 64-bit python. See the trac ticket at http://trac.dabodev.com/ticket/1179 for more information. """, UserWarning) This is my HoursBizobj.py file ========================================= #!/usr/bin/env python # -*- coding: utf-8 -*- import dabo import datetime class HoursBizobj(dabo.biz.dBizobj): def afterInit(self): self.DataSource = "hours" self.KeyField = "pkid" self.addField("hours.pkid") self.addField("hours.clientfk") self.addField("clients.clientname") self.addField("hours.servicedate") self.addField("hours.hours") self.addField("hours.notes") self.addField("hours.billed") self.addFrom("hours") self.addJoin("clients", "hours.clientfk = clients.pkid") def getClients(self): """Return a 2-tuple of lists of the client names and their keys.""" crs = self.getTempCursor() crs.execute("select pkid, clientname from clients order by clientname") ds = crs.getDataSet() # Create the lists names = [rec["clientname"] for rec in ds] keys = [rec["pkid"] for rec in ds] # Add the entry for an undefined (new) client names.insert(0, "-Please Select a Client-") keys.insert(0, 0) return (names, keys) def validateRecord(self): ret = "" # Make sure that the user selected a valid client if self.Record.clientfk == 0: ret = "You must select a valid client" return ret def beforeSave(self): bizobj = self.getBizobj(self.dataSourceParameter) # If the bizobj hasn't changed, we want to notify the user # and abort the save process, so that the new record is # not added afterwards. if not bizobj.isChanged(): return "No changes have been made; cannot save." def afterSave(self): # This will only get called if the save succeeds self.new() self.serviceDate.setFocus() def save(self): err = self.beforeSave() if err: # Display the error return # do the typical save() stuff self.afterSave() -- View this message in context: http://old.nabble.com/NameError%3A-global-name-%27datetime%27-is-not-defined-tp26559484p26559484.html Sent from the dabo-users mailing list archive at Nabble.com. _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
