Change posting dates

Mikel Larreategi <[email protected]>
Newsgroups gmane.comp.python.zope.coreblog.english
Message-ID <[email protected]>
I've writen a patch to enable date changing in posts.

I've changed manage_editEntryForm.dtml to show a field with the posting 
date, ObjectBase.py to change the date, and Entry.py to remove old 
posting date from datemap, call ObjectBase date change method, and add 
new date to datemap.

I've created 3 patch files for those files, and I attach them to this 
message. You can apply them executing this command for each file in the 
original directory where they are (COREBlog for ObjectBase and Entry and 
COREBlog/dtml for manage_editEntryForm):

$ patch -p0 < file_name

Well, these 3 files are my first patch files. I've tested them and they 
seem to be OK.

Best regards,

-- 
Mikel Larreategi
[email protected]

CodeSyntax
Azitaingo Industrialdea 3 K
E-20600 Eibar
Tel: (+34) 943 82 17 80

_______________________________________________
COREblog-en mailing list
COREblog-en-/9qXvnWia/9Wk0Htik3J/[email protected]
http://postaria.com/cgi-bin/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leave-/9qXvnWia/9Wk0Htik3J/[email protected]
Entry.diff (text/x-patch, 1 KB)
--- Entry.py	2005-02-09 09:07:21.172782836 +0100
+++ newEntry.py	2005-02-09 09:08:01.248506043 +0100
@@ -183,7 +183,7 @@
                     main_category,sub_category=[],title="",subtitle="",  \
                     format = format_plain, \
                     allow_comment=comment_open,receive_trackback = trackback_open, \
-                    trackback_url="",sendnow=0,
+                    trackback_url="",sendnow=0, created=-1
                     REQUEST=None,**kw):
         """ Edit Entry """
         #COREBlog instanse
@@ -191,6 +191,12 @@
         #Validaters
         v_h = cb.removeHTML
         v_b = cb.validateEntryBody
+        
+        # changes to edit date. by erral 2005/02/09
+        cb.removeIDFromDatemap(int(self.year_created()), int(self.month_created()), int(self.day_created()), int(self.id))
+        self.editDate(created)
+        cb.setIDToDatemap(int(self.year_created()), int(self.month_created()), int(self.day_created()), int(self.id))
+        self._p_changed = 1
 
 	cooked_body = body
 	if format in html_formats:
ObjectBase.diff (text/x-patch, 412 B)
--- ObjectBase.py	2005-01-31 14:23:47.000000000 +0100
+++ newObjectBase.py	2005-02-09 09:11:24.955396336 +0100
@@ -62,6 +62,11 @@
             self.created = created
         else:
             self.created = time()
+            
+    security.declarePrivate('editDate')            
+    def editDate(self, created):
+       if created != -1:
+           self.created = created   
 
 
     #Datetime information
manage_editEntryForm.diff (text/x-patch, 706 B)
--- manage_editEntryForm.dtml	2005-02-09 09:20:55.994258618 +0100
+++ newmanage_editEntryForm.dtml	2005-02-09 09:19:23.923305408 +0100
@@ -78,7 +78,17 @@
 	<dtml-else>
 		<input type="hidden" name="subtitle" value="<dtml-var subtitle html_quote missing="">" />
 	</dtml-if>
-       
+    
+    <dtml-comment>
+      changes by erral to change date 2005/02/09
+    </dtml-comment>
+    <tr>
+       <td align="left"><span class="form-label">Date:</span></td></tr>
+    </tr>
+    <tr>
+       <td align="left"><input type="text" size="40" name="created" value="<dtml-var date_created>"/></td>
+    </tr>
+    
 	<tr>
 		<td align="left" valign="top">
 		 	<table cellspacing="0" cellpadding="0" border="0">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.