If the summary is more than 300 chars Trim it down
Review Request #482 — Created July 31, 2008 and submitted
When using post-review with perforce there is an error if the CL description has more that 300 chars without a newline. A SQL warning is generated (truncating summary) that will cause post0review to throw an error 500. There is an example of the error page in Bug 515. This is my first attempt in Python so the code may not be the best. I created a function that will truncate a string at the first '.' or after the 300th char.
I submitted and updated a review that had more than 300 chars without a \n and a '.'. I submitted and updated a review that had more than 300 chars without a \n and did not have a '.' I submitted and updated a review that had more than 300 chars without a \n and had '.' after the 300th char
-
I started to review this but then I began to think about what we want to do here. I'm not sure truncating like this is really the desired behavior. We should be limiting the size in the web UI (which I believe we do) and we should probably provide a validation error to clients using the web API that set a value that's too long. It's then up to the calling program to limit the size. So the truncation logic should probably go in post-review.
-
-
-
CF
-
-
No doubt, obviously not trying to start a flame-war or nit-pick session. Commenting is a great idea, especially if you factor out the 300 into a global or class variable like "max_summary_length": /* truncate summary to avoid p4 error - experimental limit is 300 chars */ self.summary = truncate(self.summary, max_summary_length)