web/views/editcontroller.py
branchstable
changeset 3689 deb13e88e037
parent 3631 6176ef2f6488
child 3720 5376aaadd16b
child 3921 4f24b6ef3da9
equal deleted inserted replaced
3688:421fb447ecb2 3689:deb13e88e037
    93         # process inlined relations at the same time as attributes
    93         # process inlined relations at the same time as attributes
    94         # this is required by some external source such as the svn source which
    94         # this is required by some external source such as the svn source which
    95         # needs some information provided by those inlined relation. Moreover
    95         # needs some information provided by those inlined relation. Moreover
    96         # this will generate less write queries.
    96         # this will generate less write queries.
    97         for rschema in entity.e_schema.subject_relations():
    97         for rschema in entity.e_schema.subject_relations():
    98             if rschema.is_final():
    98             if rschema.final:
    99                 self.handle_attribute(entity, rschema, formparams)
    99                 self.handle_attribute(entity, rschema, formparams)
   100             elif rschema.inlined:
   100             elif rschema.inlined:
   101                 self.handle_inlined_relation(rschema, formparams, entity)
   101                 self.handle_inlined_relation(rschema, formparams, entity)
   102         execute = self.req.execute
   102         execute = self.req.execute
   103         if eid is None: # creation or copy
   103         if eid is None: # creation or copy
   127             if self.restrictions:
   127             if self.restrictions:
   128                 rql += ', %s' % ','.join(self.restrictions)
   128                 rql += ', %s' % ','.join(self.restrictions)
   129             formparams[var] = eid
   129             formparams[var] = eid
   130             execute(rql, formparams)
   130             execute(rql, formparams)
   131         for rschema in entity.e_schema.subject_relations():
   131         for rschema in entity.e_schema.subject_relations():
   132             if rschema.is_final() or rschema.inlined:
   132             if rschema.final or rschema.inlined:
   133                 continue
   133                 continue
   134             self.handle_relation(rschema, formparams, 'subject', entity)
   134             self.handle_relation(rschema, formparams, 'subject', entity)
   135         for rschema in entity.e_schema.object_relations():
   135         for rschema in entity.e_schema.object_relations():
   136             if rschema.is_final():
   136             if rschema.final:
   137                 continue
   137                 continue
   138             self.handle_relation(rschema, formparams, 'object', entity)
   138             self.handle_relation(rschema, formparams, 'object', entity)
   139         if edited:
   139         if edited:
   140             self.notify_edited(entity)
   140             self.notify_edited(entity)
   141         if formparams.has_key('__delete'):
   141         if formparams.has_key('__delete'):
   226                     #    key = '%s_format' % attr
   226                     #    key = '%s_format' % attr
   227                     #    formparams[key] = value[1]
   227                     #    formparams[key] = value[1]
   228                     #    self.relations.append('X %s_format %%(%s)s'
   228                     #    self.relations.append('X %s_format %%(%s)s'
   229                     #                          % (attr, key))
   229                     #                          % (attr, key))
   230                     # XXX suppose a File compatible schema
   230                     # XXX suppose a File compatible schema
   231                     if entity.e_schema.has_subject_relation('name') \
   231                     if 'name' in entity.e_schema.subjrels \
   232                            and not formparams.get('name'):
   232                            and not formparams.get('name'):
   233                         formparams['name'] = value[0]
   233                         formparams['name'] = value[0]
   234                         self.relations.append('X name %(name)s')
   234                         self.relations.append('X name %(name)s')
   235                     value = val
   235                     value = val
   236             else:
   236             else: