Changeset 2344
- Timestamp:
- 02/18/06 14:56:18 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/AUTHORS
r2329 r2344 62 62 Jason Huggins <http://www.jrandolph.com/blog/> 63 63 Michael Josephson <http://www.sdjournal.com/> 64 junzhang.jn@gmail.com 64 65 Russell Keith-Magee <freakboy@iinet.net.au> 65 66 Garth Kidd <http://www.deadlybloodyserious.com/> django/branches/magic-removal/django/contrib/syndication/feeds.py
r1995 r2344 34 34 return default 35 35 if callable(attr): 36 try: 36 # Check func_code.co_argcount rather than try/excepting the 37 # function and catching the TypeError, because something inside 38 # the function may raise the TypeError. This technique is more 39 # accurate. 40 if hasattr(attr, 'func_code'): 41 argcount = attr.func_code.co_argcount 42 else: 43 argcount = attr.__call__.func_code.co_argcount 44 if argcount == 2: # one argument is 'self' 37 45 return attr(obj) 38 e xcept TypeError:46 else: 39 47 return attr() 40 48 return attr django/branches/magic-removal/django/db/models/fields/related.py
r2289 r2344 102 102 # managerclass: class that can create and save new objects 103 103 # rel_model: the model class of the 'related' object 104 # join_table: name of the m2m link table 104 # join_table: name of the m2m link table 105 105 # this_col_name: the PK colname in join_table for 'this' object 106 106 # rel_col_name: the PK colname in join_table for the related object … … 126 126 cursor.execute("SELECT %s FROM %s WHERE %s = %%s AND %s IN (%s)" % \ 127 127 (rel_col_name, join_table, this_col_name, 128 rel_col_name, ",".join(['%s'] * len(new_ids))), 128 rel_col_name, ",".join(['%s'] * len(new_ids))), 129 129 [this_pk_val] + list(new_ids)) 130 130 if cursor.rowcount is not None and cursor.rowcount > 0: … … 145 145 # to do removal from a many-to-many field. 146 146 # rel_model: the model class of the 'related' object 147 # join_table: name of the m2m link table 147 # join_table: name of the m2m link table 148 148 # this_col_name: the PK colname in join_table for 'this' object 149 149 # rel_col_name: the PK colname in join_table for the related object … … 167 167 # Utility function used by the ManyRelatedObjectsDescriptors 168 168 # to clear all from a many-to-many field. 169 # join_table: name of the m2m link table 169 # join_table: name of the m2m link table 170 170 # this_col_name: the PK colname in join_table for 'this' object 171 171 # this_pk_val: the primary key for 'this' object … … 312 312 except AttributeError: # to._meta doesn't exist, so it must be RECURSIVE_RELATIONSHIP_CONSTANT 313 313 assert isinstance(to, basestring), "ForeignKey(%r) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string %r" % (to, RECURSIVE_RELATIONSHIP_CONSTANT) 314 kwargs['verbose_name'] = kwargs.get('verbose_name', '')315 314 else: 316 315 to_field = to_field or to._meta.pk.name 317 kwargs['verbose_name'] = kwargs.get('verbose_name', to._meta.verbose_name)316 kwargs['verbose_name'] = kwargs.get('verbose_name', '') 318 317 319 318 if kwargs.has_key('edit_inline_type'):
