← Back to team overview

cdd-dev team mailing list archive

Re: [Branch ~cdd-dev/cdd/trunk] Rev 173: Added creator's email field.

 

With this commit I get this traceback after generating a CCD:

$ python cdg.zip
Traceback (most recent call last):
  File "cdg.zip/MainFrame.py", line 204, in generate
NameError: global name 'choice_definition' is not defined


Cheers,
Tim





On Sat, Jul 14, 2012 at 6:04 PM,  <noreply@xxxxxxxxxxxxx> wrote:
> ------------------------------------------------------------
> revno: 173
> committer: Eduardo César <xcesar@xxxxxxxxx>
> branch nick: cdd
> timestamp: Sat 2012-07-14 18:03:29 -0300
> message:
>   Added creator's email field.
> modified:
>   Generator/cdg/MainFrame.py
>   Generator/cdg/cdg_custom.py
>   Generator/cdg_wxglade.wxg
>
>
> --
> lp:cdd
> https://code.launchpad.net/~cdd-dev/cdd/trunk
>
> Your team CDD Developers is subscribed to branch lp:cdd.
> To unsubscribe from this branch go to https://code.launchpad.net/~cdd-dev/cdd/trunk/+edit-subscription
>
> === modified file 'Generator/cdg/MainFrame.py'
> --- Generator/cdg/MainFrame.py  2012-07-14 20:42:45 +0000
> +++ Generator/cdg/MainFrame.py  2012-07-14 21:03:29 +0000
> @@ -27,16 +27,18 @@
>          self.text_ctrl_description = wx.TextCtrl(self.panel_principal, -1, "", style=wx.TE_MULTILINE)
>          self.label_language = wx.StaticText(self.panel_principal, -1, "Language:  ")
>          self.choice_lang = wx.Choice(self.panel_principal, -1, choices=[])
> -        self.label_creator = wx.StaticText(self.panel_principal, -1, "* Creator:  ")
> +        self.label_creator = wx.StaticText(self.panel_principal, -1, "* Creator name:  ")
>          self.text_ctrl_creator = wx.TextCtrl(self.panel_principal, -1, "")
> -        self.label_publisher = wx.StaticText(self.panel_principal, -1, "Publisher:  ")
> -        self.text_ctrl_publisher = wx.TextCtrl(self.panel_principal, -1, "")
> +        self.label_creator_email = wx.StaticText(self.panel_principal, -1, "Creator email:  ")
> +        self.text_ctrl_creator_email = wx.TextCtrl(self.panel_principal, -1, "")
>          self.label_subject = wx.StaticText(self.panel_principal, -1, "* Subject:  ")
>          self.text_ctrl_subject = wx.TextCtrl(self.panel_principal, -1, "")
>          self.label_source = wx.StaticText(self.panel_principal, -1, "Source:  ")
>          self.text_ctrl_source = wx.TextCtrl(self.panel_principal, -1, "")
>          self.label_rights = wx.StaticText(self.panel_principal, -1, "* Rights:  ")
>          self.text_ctrl_rights = wx.TextCtrl(self.panel_principal, -1, "")
> +        self.label_publisher = wx.StaticText(self.panel_principal, -1, "Publisher:  ")
> +        self.text_ctrl_publisher = wx.TextCtrl(self.panel_principal, -1, "")
>          self.label_relation = wx.StaticText(self.panel_principal, -1, "Relation:  ")
>          self.text_ctrl_relation = wx.TextCtrl(self.panel_principal, -1, "")
>          self.label_coverage = wx.StaticText(self.panel_principal, -1, "Coverage:  ")
> @@ -56,10 +58,11 @@
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_description)
>          self.Bind(wx.EVT_CHOICE, self.enable_save, self.choice_lang)
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_creator)
> -        self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_publisher)
> +        self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_creator_email)
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_subject)
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_source)
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_rights)
> +        self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_publisher)
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_relation)
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_coverage)
>          self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_contributors)
> @@ -83,8 +86,8 @@
>          self.choice_lang.SetSelection(cdg_extra.get_lang_list().index('en-US') | 0)
>          self.label_creator.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
>          self.text_ctrl_creator.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
> +        self.text_ctrl_subject.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
>          self.text_ctrl_publisher.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
> -        self.text_ctrl_subject.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
>          self.label_contributors.SetToolTipString("Separate multiple contributors with a semi-colon and format them as:Eduardo Cesar <xcesar@xxxxxxxxx>; Luciana Cavalini <lutricav@xxxxxxxxx>")
>          self.text_ctrl_contributors.SetToolTipString("Separate multiple contributors with a semi-colon and format them as:Eduardo Cesar <xcesar@xxxxxxxxx>; Luciana Cavalini <lutricav@xxxxxxxxx>")
>          self.button_save_config.Enable(False)
> @@ -119,8 +122,8 @@
>          sizer_6.Add(self.label_creator, 0, wx.ALIGN_CENTER_VERTICAL, 0)
>          sizer_6.Add(self.text_ctrl_creator, 1, wx.ALIGN_CENTER_VERTICAL, 1)
>          sizer_6.Add((20, 20), 0, 0, 0)
> -        sizer_6.Add(self.label_publisher, 0, wx.ALIGN_CENTER_VERTICAL, 0)
> -        sizer_6.Add(self.text_ctrl_publisher, 1, wx.ALIGN_CENTER_VERTICAL, 1)
> +        sizer_6.Add(self.label_creator_email, 0, wx.ALIGN_CENTER_VERTICAL, 0)
> +        sizer_6.Add(self.text_ctrl_creator_email, 1, wx.ALIGN_CENTER_VERTICAL, 1)
>          sizer_6.Add((20, 20), 0, 0, 0)
>          sizer_6.Add(self.label_subject, 0, wx.ALIGN_CENTER_VERTICAL, 0)
>          sizer_6.Add(self.text_ctrl_subject, 1, wx.ALIGN_CENTER_VERTICAL, 1)
> @@ -130,6 +133,9 @@
>          sizer_7.Add((20, 20), 0, 0, 0)
>          sizer_7.Add(self.label_rights, 0, wx.ALIGN_CENTER_VERTICAL, 0)
>          sizer_7.Add(self.text_ctrl_rights, 1, wx.ALIGN_CENTER_VERTICAL, 1)
> +        sizer_7.Add((20, 20), 0, 0, 0)
> +        sizer_7.Add(self.label_publisher, 0, wx.ALIGN_CENTER_VERTICAL, 0)
> +        sizer_7.Add(self.text_ctrl_publisher, 1, wx.ALIGN_CENTER_VERTICAL, 1)
>          sizer_3.Add(sizer_7, 1, wx.EXPAND, 0)
>          sizer_8.Add(self.label_relation, 0, wx.ALIGN_CENTER_VERTICAL, 0)
>          sizer_8.Add(self.text_ctrl_relation, 1, wx.ALIGN_CENTER_VERTICAL, 1)
> @@ -166,6 +172,7 @@
>          title = self.text_ctrl_title.GetValue().encode('utf8')
>          description = self.text_ctrl_description.GetValue().encode('utf8')
>          creator = self.text_ctrl_creator.GetValue().encode('utf8')
> +        creator_email = self.text_ctrl_creator_email.GetValue().encode('utf8')
>          contributor = self.text_ctrl_contributors.GetValue().encode('utf8')
>
>          publisher = self.text_ctrl_publisher.GetValue().encode('utf8')
> @@ -185,6 +192,7 @@
>          if not (title and date and description and creator and subject and rights):
>              cdg_extra.popup_message(self, 'The options marker with a "*" are mandatory. Please fill them before generating a CCD file.', 'Error', wx.OK|wx.ICON_EXCLAMATION)
>              return
> +        ################################################
>
>          # Get the path
>          path = cdg_extra.get_path(self)
> @@ -193,7 +201,7 @@
>
>
>          # Call the writing routine
> -        ccd_id = cdg_custom.generate_files(path, title, description, date, creator, contributor, language, publisher, subject, source, rights, relation, coverage, choice_definition)
> +        ccd_id = cdg_custom.generate_files(path, title, description, date, creator, creator_email, contributor, language, publisher, subject, source, rights, relation, coverage, choice_definition)
>
>
>          # Show dialog
>
> === modified file 'Generator/cdg/cdg_custom.py'
> --- Generator/cdg/cdg_custom.py 2012-07-14 20:42:45 +0000
> +++ Generator/cdg/cdg_custom.py 2012-07-14 21:03:29 +0000
> @@ -4,7 +4,7 @@
>  import ConfigParser
>  from xml.sax.saxutils import escape
>
> -def generate_files(path, title, description, date, creator, contributor, language, publisher, subject, source, rights, relation, coverage, choice_definition):
> +def generate_files(path, title, description, date, creator, creator_email, contributor, language, publisher, subject, source, rights, relation, coverage, choice_definition):
>
>      ccd_id = "ccd_"+str(uuid.uuid4()).replace('-','_')
>      UUID_definition = "ct_"+str(uuid.uuid4()).replace('-','_')
> @@ -35,7 +35,7 @@
>
>         <rdf:Description rdf:about="http://www.hkcr.net/ccd/{ccd_id}";>
>           <dc:title>{title}</dc:title>
> -         <dc:creator>{creator}</dc:creator>
> +         <dc:creator>{creator} &lt;{creator_email}&gt; </dc:creator>
>            {contributors}
>            <dc:subject>{subject}</dc:subject>
>           <dc:source>{source}</dc:source>
> @@ -103,6 +103,7 @@
>             description = escape(description),
>             date = date,
>             creator = escape(creator),
> +           creator_email = escape(creator_email),
>             contributors = contributors_formated,
>             language = language,
>             publisher = escape(publisher),
> @@ -144,24 +145,12 @@
>          self.configname = self.configdir + '/cdg.cfg'
>
>          self.panel = panel
> -
> -
> -        self.title = None
> -        self.description = None
> -        self.creator = None
> -        self.contributor = None
> -
> -        self.publisher = None
> -        self.subject = None
> -        self.source = None
> -        self.rights = None
> -        self.relation = None
> -        self.coverage = None
>
>          self.config = ConfigParser.SafeConfigParser({
>                  'title' : '',
>                  'description' : '',
>                  'creator' : '',
> +                'creator_email' : '',
>                  'contributor' : '',
>                  'publisher' : '',
>                  'subject' : '',
> @@ -197,6 +186,7 @@
>          self.config.set('DEFAULT', 'title', self.panel.text_ctrl_title.GetValue().encode('utf8'))
>          self.config.set('DEFAULT', 'description', self.panel.text_ctrl_description.GetValue().encode('utf8'))
>          self.config.set('DEFAULT', 'creator', self.panel.text_ctrl_creator.GetValue().encode('utf8'))
> +        self.config.set('DEFAULT', 'creator_email', self.panel.text_ctrl_creator_email.GetValue().encode('utf8'))
>          self.config.set('DEFAULT', 'contributor', self.panel.text_ctrl_contributors.GetValue().encode('utf8'))
>
>          self.config.set('DEFAULT', 'publisher', self.panel.text_ctrl_publisher.GetValue().encode('utf8'))
> @@ -207,7 +197,6 @@
>          self.config.set('DEFAULT', 'coverage', self.panel.text_ctrl_coverage.GetValue().encode('utf8'))
>
>          self.config.set('DEFAULT', 'language', str(self.panel.choice_lang.GetSelection()))
> -        self.config.set('DEFAULT', 'choice_definition', str(self.panel.combo_box_ccd.GetSelection()))
>
>      def set_panel_configs(self):
>          self.panel.text_ctrl_title.SetValue(self.config.get('DEFAULT', 'title'))
>
> === modified file 'Generator/cdg_wxglade.wxg'
> --- Generator/cdg_wxglade.wxg   2012-07-14 20:24:12 +0000
> +++ Generator/cdg_wxglade.wxg   2012-07-14 21:03:29 +0000
> @@ -1,5 +1,5 @@
>  <?xml version="1.0"?>
> -<!-- generated by wxGlade 0.6.4 on Sat Jul 14 17:22:44 2012 -->
> +<!-- generated by wxGlade 0.6.4 on Sat Jul 14 18:00:49 2012 -->
>
>  <application path="cdg" name="" class="" option="1" language="python" top_window="frame_principal" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0" indent_amount="4" indent_symbol="space" source_extension=".cpp" header_extension=".h">
>      <object class="MainFrame" name="frame_principal" base="EditFrame">
> @@ -168,7 +168,7 @@
>                                              <object class="wxStaticText" name="label_creator" base="EditStaticText">
>                                                  <attribute>1</attribute>
>                                                  <tooltip>Format emails as: Timothy W. Cook &lt;timothywayne.cook@xxxxxxxxx&gt;</tooltip>
> -                                                <label>* Creator:  </label>
> +                                                <label>* Creator name:  </label>
>                                              </object>
>                                          </object>
>                                          <object class="sizeritem">
> @@ -194,17 +194,16 @@
>                                              <flag>wxALIGN_CENTER_VERTICAL</flag>
>                                              <border>0</border>
>                                              <option>0</option>
> -                                            <object class="wxStaticText" name="label_publisher" base="EditStaticText">
> +                                            <object class="wxStaticText" name="label_creator_email" base="EditStaticText">
>                                                  <attribute>1</attribute>
> -                                                <label>Publisher:  </label>
> +                                                <label>Creator email:  </label>
>                                              </object>
>                                          </object>
>                                          <object class="sizeritem">
>                                              <flag>wxALIGN_CENTER_VERTICAL</flag>
>                                              <border>1</border>
>                                              <option>1</option>
> -                                            <object class="wxTextCtrl" name="text_ctrl_publisher" base="EditTextCtrl">
> -                                                <tooltip>Format emails as: Timothy W. Cook &lt;timothywayne.cook@xxxxxxxxx&gt;</tooltip>
> +                                            <object class="wxTextCtrl" name="text_ctrl_creator_email" base="EditTextCtrl">
>                                                  <events>
>                                                      <handler event="EVT_TEXT">enable_save</handler>
>                                                  </events>
> @@ -292,6 +291,34 @@
>                                                  </events>
>                                              </object>
>                                          </object>
> +                                        <object class="sizeritem">
> +                                            <border>0</border>
> +                                            <option>0</option>
> +                                            <object class="spacer" name="spacer" base="EditSpacer">
> +                                                <height>20</height>
> +                                                <width>20</width>
> +                                            </object>
> +                                        </object>
> +                                        <object class="sizeritem">
> +                                            <flag>wxALIGN_CENTER_VERTICAL</flag>
> +                                            <border>0</border>
> +                                            <option>0</option>
> +                                            <object class="wxStaticText" name="label_publisher" base="EditStaticText">
> +                                                <attribute>1</attribute>
> +                                                <label>Publisher:  </label>
> +                                            </object>
> +                                        </object>
> +                                        <object class="sizeritem">
> +                                            <flag>wxALIGN_CENTER_VERTICAL</flag>
> +                                            <border>1</border>
> +                                            <option>1</option>
> +                                            <object class="wxTextCtrl" name="text_ctrl_publisher" base="EditTextCtrl">
> +                                                <tooltip>Format emails as: Timothy W. Cook &lt;timothywayne.cook@xxxxxxxxx&gt;</tooltip>
> +                                                <events>
> +                                                    <handler event="EVT_TEXT">enable_save</handler>
> +                                                </events>
> +                                            </object>
> +                                        </object>
>                                      </object>
>                                  </object>
>                                  <object class="sizeritem">
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~cdd-dev
> Post to     : cdd-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~cdd-dev
> More help   : https://help.launchpad.net/ListHelp
>



-- 
============================================
Timothy Cook, MSc           +55 21 94711995
MLHIM http://www.mlhim.org
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == timothy.cook
Academic.Edu Profile: http://uff.academia.edu/TimothyCook


Follow ups

References